OLD | NEW |
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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 JS_STATIC_METHOD_ENTRY(signatureGetModifications) | 103 JS_STATIC_METHOD_ENTRY(signatureGetModifications) |
104 JS_STATIC_METHOD_ENTRY(signatureGetSeedValue) | 104 JS_STATIC_METHOD_ENTRY(signatureGetSeedValue) |
105 JS_STATIC_METHOD_ENTRY(signatureInfo) | 105 JS_STATIC_METHOD_ENTRY(signatureInfo) |
106 JS_STATIC_METHOD_ENTRY(signatureSetSeedValue) | 106 JS_STATIC_METHOD_ENTRY(signatureSetSeedValue) |
107 JS_STATIC_METHOD_ENTRY(signatureSign) | 107 JS_STATIC_METHOD_ENTRY(signatureSign) |
108 JS_STATIC_METHOD_ENTRY(signatureValidate) | 108 JS_STATIC_METHOD_ENTRY(signatureValidate) |
109 END_JS_STATIC_METHOD() | 109 END_JS_STATIC_METHOD() |
110 | 110 |
111 IMPLEMENT_JS_CLASS(CJS_Field, Field) | 111 IMPLEMENT_JS_CLASS(CJS_Field, Field) |
112 | 112 |
113 FX_BOOL»CJS_Field::InitInstance(IFXJS_Context* cc) | 113 bool» CJS_Field::InitInstance(IFXJS_Context* cc) |
114 { | 114 { |
115 CJS_Context* pContext = (CJS_Context*)cc; | 115 CJS_Context* pContext = (CJS_Context*)cc; |
116 ASSERT(pContext != NULL); | 116 ASSERT(pContext != NULL); |
117 | 117 |
118 Field* pField = (Field*)GetEmbedObject(); | 118 Field* pField = (Field*)GetEmbedObject(); |
119 ASSERT(pField != NULL); | 119 ASSERT(pField != NULL); |
120 | 120 |
121 pField->SetIsolate(pContext->GetJSRuntime()->GetIsolate()); | 121 pField->SetIsolate(pContext->GetJSRuntime()->GetIsolate()); |
122 | 122 |
123 » return TRUE; | 123 » return true; |
124 }; | 124 }; |
125 | 125 |
126 Field::Field(CJS_Object* pJSObject): CJS_EmbedObj(pJSObject), | 126 Field::Field(CJS_Object* pJSObject): CJS_EmbedObj(pJSObject), |
127 m_pJSDoc(NULL), | 127 m_pJSDoc(NULL), |
128 m_pDocument(NULL), | 128 m_pDocument(NULL), |
129 m_nFormControlIndex(-1), | 129 m_nFormControlIndex(-1), |
130 » m_bCanSet(FALSE), | 130 » m_bCanSet(false), |
131 » m_bDelay(FALSE), | 131 » m_bDelay(false), |
132 m_isolate(NULL) | 132 m_isolate(NULL) |
133 { | 133 { |
134 } | 134 } |
135 | 135 |
136 Field::~Field() | 136 Field::~Field() |
137 { | 137 { |
138 } | 138 } |
139 | 139 |
140 //note: iControlNo = -1, means not a widget. | 140 //note: iControlNo = -1, means not a widget. |
141 void Field::ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &
strFieldName,int & iControlNo) | 141 void Field::ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &
strFieldName,int & iControlNo) |
(...skipping 19 matching lines...) Expand all Loading... |
161 { | 161 { |
162 strFieldName = strFieldNameParsed; | 162 strFieldName = strFieldNameParsed; |
163 iControlNo = -1; | 163 iControlNo = -1; |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 } | 167 } |
168 strFieldName = strFieldNameParsed.substr(0,iStart); | 168 strFieldName = strFieldNameParsed.substr(0,iStart); |
169 } | 169 } |
170 | 170 |
171 FX_BOOL Field::AttachField(Document* pDocument, const CFX_WideString& csFieldNam
e) | 171 bool Field::AttachField(Document* pDocument, const CFX_WideString& csFieldName) |
172 { | 172 { |
173 ASSERT(pDocument != NULL); | 173 ASSERT(pDocument != NULL); |
174 m_pJSDoc = pDocument; | 174 m_pJSDoc = pDocument; |
175 | 175 |
176 m_pDocument = pDocument->GetReaderDoc(); | 176 m_pDocument = pDocument->GetReaderDoc(); |
177 ASSERT(m_pDocument != NULL); | 177 ASSERT(m_pDocument != NULL); |
178 | 178 |
179 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || | 179 m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) || |
180 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 180 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
181 m_pDocument->GetPermissions(FPDFPERM_MODIFY); | 181 m_pDocument->GetPermissions(FPDFPERM_MODIFY); |
182 | 182 |
183 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); | 183 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); |
184 ASSERT(pRDInterForm != NULL); | 184 ASSERT(pRDInterForm != NULL); |
185 | 185 |
186 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); | 186 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); |
187 ASSERT(pInterForm != NULL); | 187 ASSERT(pInterForm != NULL); |
188 | 188 |
189 CFX_WideString swFieldNameTemp = csFieldName; | 189 CFX_WideString swFieldNameTemp = csFieldName; |
190 swFieldNameTemp.Replace(L"..", L"."); | 190 swFieldNameTemp.Replace(L"..", L"."); |
191 | 191 |
192 if (pInterForm->CountFields(swFieldNameTemp) <= 0) | 192 if (pInterForm->CountFields(swFieldNameTemp) <= 0) |
193 { | 193 { |
194 std::wstring strFieldName; | 194 std::wstring strFieldName; |
195 int iControlNo = -1; | 195 int iControlNo = -1; |
196 ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo
); | 196 ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo
); |
197 » » if (iControlNo == -1) return FALSE; | 197 » » if (iControlNo == -1) return false; |
198 | 198 |
199 m_FieldName = strFieldName.c_str(); | 199 m_FieldName = strFieldName.c_str(); |
200 m_nFormControlIndex = iControlNo; | 200 m_nFormControlIndex = iControlNo; |
201 » » return TRUE; | 201 » » return true; |
202 } | 202 } |
203 | 203 |
204 m_FieldName = swFieldNameTemp; | 204 m_FieldName = swFieldNameTemp; |
205 m_nFormControlIndex = -1; | 205 m_nFormControlIndex = -1; |
206 | 206 |
207 » return TRUE; | 207 » return true; |
208 } | 208 } |
209 | 209 |
210 void Field::GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csF
ieldName, CFX_PtrArray& FieldArray) | 210 void Field::GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csF
ieldName, CFX_PtrArray& FieldArray) |
211 { | 211 { |
212 ASSERT(pDocument != NULL); | 212 ASSERT(pDocument != NULL); |
213 | 213 |
214 CPDFSDK_InterForm* pReaderInterForm = pDocument->GetInterForm(); | 214 CPDFSDK_InterForm* pReaderInterForm = pDocument->GetInterForm(); |
215 ASSERT(pReaderInterForm != NULL); | 215 ASSERT(pReaderInterForm != NULL); |
216 | 216 |
217 CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm(); | 217 CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm(); |
218 ASSERT(pInterForm != NULL); | 218 ASSERT(pInterForm != NULL); |
219 | 219 |
220 ASSERT(FieldArray.GetSize() == 0); | 220 ASSERT(FieldArray.GetSize() == 0); |
221 | 221 |
222 for (int i=0,sz=pInterForm->CountFields(csFieldName); i<sz; i++) | 222 for (int i=0,sz=pInterForm->CountFields(csFieldName); i<sz; i++) |
223 { | 223 { |
224 if (CPDF_FormField* pFormField = pInterForm->GetField(i, csField
Name)) | 224 if (CPDF_FormField* pFormField = pInterForm->GetField(i, csField
Name)) |
225 FieldArray.Add((void*)pFormField); | 225 FieldArray.Add((void*)pFormField); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 void Field::GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& Field
Array) | 229 void Field::GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& Field
Array) |
230 { | 230 { |
231 ASSERT(m_pDocument != NULL); | 231 ASSERT(m_pDocument != NULL); |
232 | 232 |
233 Field::GetFormFields(m_pDocument, csFieldName, FieldArray); | 233 Field::GetFormFields(m_pDocument, csFieldName, FieldArray); |
234 } | 234 } |
235 | 235 |
236 void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormFi
eld, | 236 void Field::UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormFi
eld, |
237 » » » » » » » FX_BOOL bChangeMark, FX_
BOOL bResetAP, FX_BOOL bRefresh) | 237 » » » » » » » bool bChangeMark, bool b
ResetAP, bool bRefresh) |
238 { | 238 { |
239 ASSERT(pDocument != NULL); | 239 ASSERT(pDocument != NULL); |
240 ASSERT(pFormField != NULL); | 240 ASSERT(pFormField != NULL); |
241 | 241 |
242 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 242 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
243 ASSERT(pInterForm != NULL); | 243 ASSERT(pInterForm != NULL); |
244 | 244 |
245 CFX_PtrArray widgets; | 245 CFX_PtrArray widgets; |
246 pInterForm->GetWidgets(pFormField, widgets); | 246 pInterForm->GetWidgets(pFormField, widgets); |
247 | 247 |
248 if (bResetAP) | 248 if (bResetAP) |
249 { | 249 { |
250 int nFieldType = pFormField->GetFieldType(); | 250 int nFieldType = pFormField->GetFieldType(); |
251 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_
TEXTFIELD) | 251 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_
TEXTFIELD) |
252 { | 252 { |
253 for (int i=0,sz=widgets.GetSize(); i<sz; i++) | 253 for (int i=0,sz=widgets.GetSize(); i<sz; i++) |
254 { | 254 { |
255 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widge
ts.GetAt(i); | 255 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widge
ts.GetAt(i); |
256 ASSERT(pWidget != NULL); | 256 ASSERT(pWidget != NULL); |
257 | 257 |
258 » » » » FX_BOOL bFormated = FALSE; | 258 » » » » bool bFormated = false; |
259 CFX_WideString sValue = pWidget->OnFormat(bForma
ted); | 259 CFX_WideString sValue = pWidget->OnFormat(bForma
ted); |
260 if (bFormated) | 260 if (bFormated) |
261 » » » » » pWidget->ResetAppearance(sValue.c_str(),
FALSE); | 261 » » » » » pWidget->ResetAppearance(sValue.c_str(),
false); |
262 else | 262 else |
263 » » » » » pWidget->ResetAppearance(NULL, FALSE); | 263 » » » » » pWidget->ResetAppearance(NULL, false); |
264 } | 264 } |
265 } | 265 } |
266 else | 266 else |
267 { | 267 { |
268 for (int i=0,sz=widgets.GetSize(); i<sz; i++) | 268 for (int i=0,sz=widgets.GetSize(); i<sz; i++) |
269 { | 269 { |
270 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widge
ts.GetAt(i); | 270 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widge
ts.GetAt(i); |
271 ASSERT(pWidget != NULL); | 271 ASSERT(pWidget != NULL); |
272 | 272 |
273 » » » » pWidget->ResetAppearance(NULL, FALSE); | 273 » » » » pWidget->ResetAppearance(NULL, false); |
274 } | 274 } |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 if (bRefresh) | 278 if (bRefresh) |
279 { | 279 { |
280 for (int i=0,sz=widgets.GetSize(); i<sz; i++) | 280 for (int i=0,sz=widgets.GetSize(); i<sz; i++) |
281 { | 281 { |
282 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt
(i); | 282 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgets.GetAt
(i); |
283 ASSERT(pWidget != NULL); | 283 ASSERT(pWidget != NULL); |
284 | 284 |
285 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm()
; | 285 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm()
; |
286 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); | 286 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); |
287 // CReader_Page* pPage = pWidget->GetPage(); | 287 // CReader_Page* pPage = pWidget->GetPage(); |
288 ASSERT(pDoc != NULL); | 288 ASSERT(pDoc != NULL); |
289 pDoc->UpdateAllViews(NULL, pWidget); | 289 pDoc->UpdateAllViews(NULL, pWidget); |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 if (bChangeMark) | 293 if (bChangeMark) |
294 pDocument->SetChangeMark(); | 294 pDocument->SetChangeMark(); |
295 } | 295 } |
296 | 296 |
297 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFo
rmControl, | 297 void Field::UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFo
rmControl, |
298 » » » » » » » FX_BOOL bChangeMark, FX_
BOOL bResetAP, FX_BOOL bRefresh) | 298 » » » » » » » bool bChangeMark, bool b
ResetAP, bool bRefresh) |
299 { | 299 { |
300 ASSERT(pDocument != NULL); | 300 ASSERT(pDocument != NULL); |
301 ASSERT(pFormControl != NULL); | 301 ASSERT(pFormControl != NULL); |
302 | 302 |
303 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 303 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
304 ASSERT(pInterForm != NULL); | 304 ASSERT(pInterForm != NULL); |
305 | 305 |
306 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); | 306 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl); |
307 | 307 |
308 if (pWidget) | 308 if (pWidget) |
309 { | 309 { |
310 if (bResetAP) | 310 if (bResetAP) |
311 { | 311 { |
312 int nFieldType = pWidget->GetFieldType(); | 312 int nFieldType = pWidget->GetFieldType(); |
313 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FI
ELDTYPE_TEXTFIELD) | 313 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FI
ELDTYPE_TEXTFIELD) |
314 { | 314 { |
315 » » » » FX_BOOL bFormated = FALSE; | 315 » » » » bool bFormated = false; |
316 CFX_WideString sValue = pWidget->OnFormat(bForma
ted); | 316 CFX_WideString sValue = pWidget->OnFormat(bForma
ted); |
317 if (bFormated) | 317 if (bFormated) |
318 » » » » » pWidget->ResetAppearance(sValue.c_str(),
FALSE); | 318 » » » » » pWidget->ResetAppearance(sValue.c_str(),
false); |
319 else | 319 else |
320 » » » » » pWidget->ResetAppearance(NULL, FALSE); | 320 » » » » » pWidget->ResetAppearance(NULL, false); |
321 } | 321 } |
322 else | 322 else |
323 { | 323 { |
324 » » » » pWidget->ResetAppearance(NULL, FALSE); | 324 » » » » pWidget->ResetAppearance(NULL, false); |
325 } | 325 } |
326 } | 326 } |
327 | 327 |
328 if (bRefresh) | 328 if (bRefresh) |
329 { | 329 { |
330 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm()
; | 330 CPDFSDK_InterForm * pInterForm = pWidget->GetInterForm()
; |
331 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); | 331 CPDFSDK_Document* pDoc = pInterForm->GetDocument(); |
332 ASSERT(pDoc != NULL); | 332 ASSERT(pDoc != NULL); |
333 pDoc->UpdateAllViews(NULL, pWidget); | 333 pDoc->UpdateAllViews(NULL, pWidget); |
334 } | 334 } |
335 | 335 |
336 } | 336 } |
337 | 337 |
338 if (bChangeMark) | 338 if (bChangeMark) |
339 pDocument->SetChangeMark(); | 339 pDocument->SetChangeMark(); |
340 } | 340 } |
341 | 341 |
342 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl*
pFormControl) | 342 CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl*
pFormControl) |
343 { | 343 { |
344 ASSERT(pDocument != NULL); | 344 ASSERT(pDocument != NULL); |
345 ASSERT(pFormControl != NULL); | 345 ASSERT(pFormControl != NULL); |
346 | 346 |
347 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 347 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
348 ASSERT(pInterForm != NULL); | 348 ASSERT(pInterForm != NULL); |
349 | 349 |
350 return pInterForm->GetWidget(pFormControl); | 350 return pInterForm->GetWidget(pFormControl); |
351 } | 351 } |
352 | 352 |
353 FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabe
l) | 353 bool Field::ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel) |
354 { | 354 { |
355 ASSERT(pFormField != NULL); | 355 ASSERT(pFormField != NULL); |
356 | 356 |
357 for (int i=0,sz = pFormField->CountOptions(); i < sz; i++) | 357 for (int i=0,sz = pFormField->CountOptions(); i < sz; i++) |
358 { | 358 { |
359 if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) | 359 if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) |
360 » » » return TRUE; | 360 » » » return true; |
361 } | 361 } |
362 | 362 |
363 » return FALSE; | 363 » return false; |
364 } | 364 } |
365 | 365 |
366 CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) | 366 CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) |
367 { | 367 { |
368 ASSERT(pFormField != NULL); | 368 ASSERT(pFormField != NULL); |
369 if(!pFormField->CountControls() || m_nFormControlIndex>=pFormField->Coun
tControls()) return NULL; | 369 if(!pFormField->CountControls() || m_nFormControlIndex>=pFormField->Coun
tControls()) return NULL; |
370 | 370 |
371 if (m_nFormControlIndex<0) | 371 if (m_nFormControlIndex<0) |
372 return pFormField->GetControl(0); | 372 return pFormField->GetControl(0); |
373 else | 373 else |
374 return pFormField->GetControl(m_nFormControlIndex); | 374 return pFormField->GetControl(m_nFormControlIndex); |
375 } | 375 } |
376 | 376 |
377 /* ---------------------------------------- property ---------------------------
------------- */ | 377 /* ---------------------------------------- property ---------------------------
------------- */ |
378 | 378 |
379 FX_BOOL Field::alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 379 bool Field::alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
380 { | 380 { |
381 ASSERT(m_pDocument != NULL); | 381 ASSERT(m_pDocument != NULL); |
382 | 382 |
383 if (vp.IsSetting()) | 383 if (vp.IsSetting()) |
384 { | 384 { |
385 » » if (!m_bCanSet) return FALSE; | 385 » » if (!m_bCanSet) return false; |
386 | 386 |
387 CFX_ByteString alignStr; | 387 CFX_ByteString alignStr; |
388 vp >> alignStr; | 388 vp >> alignStr; |
389 | 389 |
390 if (m_bDelay) | 390 if (m_bDelay) |
391 { | 391 { |
392 AddDelay_String(FP_ALIGNMENT, alignStr); | 392 AddDelay_String(FP_ALIGNMENT, alignStr); |
393 } | 393 } |
394 else | 394 else |
395 { | 395 { |
396 Field::SetAlignment(m_pDocument, m_FieldName, m_nFormCon
trolIndex, alignStr); | 396 Field::SetAlignment(m_pDocument, m_FieldName, m_nFormCon
trolIndex, alignStr); |
397 } | 397 } |
398 } | 398 } |
399 else | 399 else |
400 { | 400 { |
401 CFX_PtrArray FieldArray; | 401 CFX_PtrArray FieldArray; |
402 GetFormFields(m_FieldName, FieldArray); | 402 GetFormFields(m_FieldName, FieldArray); |
403 » » if (FieldArray.GetSize() <= 0) return FALSE; | 403 » » if (FieldArray.GetSize() <= 0) return false; |
404 | 404 |
405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
406 ASSERT(pFormField != NULL); | 406 ASSERT(pFormField != NULL); |
407 | 407 |
408 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 408 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
409 » » » return FALSE; | 409 » » » return false; |
410 | 410 |
411 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 411 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
412 » » if (!pFormControl)return FALSE; | 412 » » if (!pFormControl)return false; |
413 | 413 |
414 switch (pFormControl->GetControlAlignment()) | 414 switch (pFormControl->GetControlAlignment()) |
415 { | 415 { |
416 case 1: | 416 case 1: |
417 vp << L"center"; | 417 vp << L"center"; |
418 break; | 418 break; |
419 case 0: | 419 case 0: |
420 vp << L"left"; | 420 vp << L"left"; |
421 break; | 421 break; |
422 case 2: | 422 case 2: |
423 vp << L"right"; | 423 vp << L"right"; |
424 break; | 424 break; |
425 default: | 425 default: |
426 vp << L""; | 426 vp << L""; |
427 } | 427 } |
428 } | 428 } |
429 | 429 |
430 » return TRUE; | 430 » return true; |
431 } | 431 } |
432 | 432 |
433 void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, | 433 void Field::SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, |
434 const CFX_ByteString& string) | 434 const CFX_ByteString& string) |
435 { | 435 { |
436 //Not supported. | 436 //Not supported. |
437 } | 437 } |
438 | 438 |
439 FX_BOOL Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) | 439 bool Field::borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
440 { | 440 { |
441 ASSERT(m_pDocument != NULL); | 441 ASSERT(m_pDocument != NULL); |
442 | 442 |
443 if (vp.IsSetting()) | 443 if (vp.IsSetting()) |
444 { | 444 { |
445 » » if (!m_bCanSet) return FALSE; | 445 » » if (!m_bCanSet) return false; |
446 | 446 |
447 CFX_ByteString strType = ""; | 447 CFX_ByteString strType = ""; |
448 vp >> strType; | 448 vp >> strType; |
449 | 449 |
450 if (m_bDelay) | 450 if (m_bDelay) |
451 { | 451 { |
452 AddDelay_String(FP_BORDERSTYLE, strType); | 452 AddDelay_String(FP_BORDERSTYLE, strType); |
453 } | 453 } |
454 else | 454 else |
455 { | 455 { |
456 Field::SetBorderStyle(m_pDocument, m_FieldName, m_nFormC
ontrolIndex, strType); | 456 Field::SetBorderStyle(m_pDocument, m_FieldName, m_nFormC
ontrolIndex, strType); |
457 } | 457 } |
458 } | 458 } |
459 else | 459 else |
460 { | 460 { |
461 CFX_PtrArray FieldArray; | 461 CFX_PtrArray FieldArray; |
462 GetFormFields(m_FieldName, FieldArray); | 462 GetFormFields(m_FieldName, FieldArray); |
463 » » if (FieldArray.GetSize() <= 0) return FALSE; | 463 » » if (FieldArray.GetSize() <= 0) return false; |
464 | 464 |
465 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 465 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
466 » » if (!pFormField) return FALSE; | 466 » » if (!pFormField) return false; |
467 | 467 |
468 CPDFSDK_Widget* pWidget = GetWidget(m_pDocument, GetSmartFieldCo
ntrol(pFormField)); | 468 CPDFSDK_Widget* pWidget = GetWidget(m_pDocument, GetSmartFieldCo
ntrol(pFormField)); |
469 » » if (!pWidget) return FALSE; | 469 » » if (!pWidget) return false; |
470 | 470 |
471 int nBorderstyle = pWidget->GetBorderStyle(); | 471 int nBorderstyle = pWidget->GetBorderStyle(); |
472 | 472 |
473 switch (nBorderstyle) | 473 switch (nBorderstyle) |
474 { | 474 { |
475 case BBS_SOLID: | 475 case BBS_SOLID: |
476 vp << L"solid"; | 476 vp << L"solid"; |
477 break; | 477 break; |
478 case BBS_DASH: | 478 case BBS_DASH: |
479 vp << L"dashed"; | 479 vp << L"dashed"; |
480 break; | 480 break; |
481 case BBS_BEVELED: | 481 case BBS_BEVELED: |
482 vp << L"beveled"; | 482 vp << L"beveled"; |
483 break; | 483 break; |
484 case BBS_INSET: | 484 case BBS_INSET: |
485 vp << L"inset"; | 485 vp << L"inset"; |
486 break; | 486 break; |
487 case BBS_UNDERLINE: | 487 case BBS_UNDERLINE: |
488 vp << L"underline"; | 488 vp << L"underline"; |
489 break; | 489 break; |
490 default: | 490 default: |
491 vp << L""; | 491 vp << L""; |
492 break; | 492 break; |
493 } | 493 } |
494 } | 494 } |
495 | 495 |
496 » return TRUE; | 496 » return true; |
497 } | 497 } |
498 | 498 |
499 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw
FieldName, int nControlIndex, | 499 void Field::SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& sw
FieldName, int nControlIndex, |
500 const CFX_ByteString& string) | 500 const CFX_ByteString& string) |
501 { | 501 { |
502 ASSERT(pDocument != NULL); | 502 ASSERT(pDocument != NULL); |
503 | 503 |
504 int nBorderStyle = 0; | 504 int nBorderStyle = 0; |
505 | 505 |
506 if (string == "solid") | 506 if (string == "solid") |
(...skipping 11 matching lines...) Expand all Loading... |
518 CFX_PtrArray FieldArray; | 518 CFX_PtrArray FieldArray; |
519 GetFormFields(pDocument, swFieldName, FieldArray); | 519 GetFormFields(pDocument, swFieldName, FieldArray); |
520 | 520 |
521 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 521 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
522 { | 522 { |
523 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 523 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
524 ASSERT(pFormField != NULL); | 524 ASSERT(pFormField != NULL); |
525 | 525 |
526 if (nControlIndex < 0) | 526 if (nControlIndex < 0) |
527 { | 527 { |
528 » » » FX_BOOL bSet = FALSE; | 528 » » » bool bSet = false; |
529 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j
++) | 529 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j
++) |
530 { | 530 { |
531 if (CPDFSDK_Widget* pWidget = GetWidget(pDocumen
t, pFormField->GetControl(j))) | 531 if (CPDFSDK_Widget* pWidget = GetWidget(pDocumen
t, pFormField->GetControl(j))) |
532 { | 532 { |
533 if (pWidget->GetBorderStyle() != nBorder
Style) | 533 if (pWidget->GetBorderStyle() != nBorder
Style) |
534 { | 534 { |
535 pWidget->SetBorderStyle(nBorderS
tyle); | 535 pWidget->SetBorderStyle(nBorderS
tyle); |
536 » » » » » » bSet = TRUE; | 536 » » » » » » bSet = true; |
537 } | 537 } |
538 } | 538 } |
539 } | 539 } |
540 » » » if (bSet) UpdateFormField(pDocument, pFormField, TRUE, T
RUE, TRUE); | 540 » » » if (bSet) UpdateFormField(pDocument, pFormField, true, t
rue, true); |
541 } | 541 } |
542 else | 542 else |
543 { | 543 { |
544 if(nControlIndex >= pFormField->CountControls()) return; | 544 if(nControlIndex >= pFormField->CountControls()) return; |
545 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) | 545 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) |
546 { | 546 { |
547 if (CPDFSDK_Widget* pWidget = GetWidget(pDocumen
t, pFormControl)) | 547 if (CPDFSDK_Widget* pWidget = GetWidget(pDocumen
t, pFormControl)) |
548 { | 548 { |
549 if (pWidget->GetBorderStyle() != nBorder
Style) | 549 if (pWidget->GetBorderStyle() != nBorder
Style) |
550 { | 550 { |
551 pWidget->SetBorderStyle(nBorderS
tyle); | 551 pWidget->SetBorderStyle(nBorderS
tyle); |
552 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, TRUE, TRUE, TRUE); | 552 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, true, true, true); |
553 } | 553 } |
554 } | 554 } |
555 } | 555 } |
556 } | 556 } |
557 } | 557 } |
558 } | 558 } |
559 | 559 |
560 FX_BOOL Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) | 560 bool Field::buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
561 { | 561 { |
562 ASSERT(m_pDocument != NULL); | 562 ASSERT(m_pDocument != NULL); |
563 | 563 |
564 if (vp.IsSetting()) | 564 if (vp.IsSetting()) |
565 { | 565 { |
566 » » if (!m_bCanSet) return FALSE; | 566 » » if (!m_bCanSet) return false; |
567 | 567 |
568 int nVP; | 568 int nVP; |
569 vp >> nVP; | 569 vp >> nVP; |
570 | 570 |
571 if (m_bDelay) | 571 if (m_bDelay) |
572 { | 572 { |
573 AddDelay_Int(FP_BUTTONALIGNX, nVP); | 573 AddDelay_Int(FP_BUTTONALIGNX, nVP); |
574 } | 574 } |
575 else | 575 else |
576 { | 576 { |
577 Field::SetButtonAlignX(m_pDocument, m_FieldName, m_nForm
ControlIndex, nVP); | 577 Field::SetButtonAlignX(m_pDocument, m_FieldName, m_nForm
ControlIndex, nVP); |
578 } | 578 } |
579 } | 579 } |
580 else | 580 else |
581 { | 581 { |
582 CFX_PtrArray FieldArray; | 582 CFX_PtrArray FieldArray; |
583 GetFormFields(m_FieldName,FieldArray); | 583 GetFormFields(m_FieldName,FieldArray); |
584 » » if (FieldArray.GetSize() <= 0) return FALSE; | 584 » » if (FieldArray.GetSize() <= 0) return false; |
585 | 585 |
586 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 586 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
587 ASSERT(pFormField != NULL); | 587 ASSERT(pFormField != NULL); |
588 | 588 |
589 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 589 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
590 » » » return FALSE; | 590 » » » return false; |
591 | 591 |
592 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 592 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
593 » » if (!pFormControl)return FALSE; | 593 » » if (!pFormControl)return false; |
594 | 594 |
595 CPDF_IconFit IconFit = pFormControl->GetIconFit(); | 595 CPDF_IconFit IconFit = pFormControl->GetIconFit(); |
596 | 596 |
597 FX_FLOAT fLeft,fBottom; | 597 FX_FLOAT fLeft,fBottom; |
598 IconFit.GetIconPosition(fLeft,fBottom); | 598 IconFit.GetIconPosition(fLeft,fBottom); |
599 | 599 |
600 vp << (int32_t)fLeft; | 600 vp << (int32_t)fLeft; |
601 } | 601 } |
602 | 602 |
603 » return TRUE; | 603 » return true; |
604 } | 604 } |
605 | 605 |
606 void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex, int number) | 606 void Field::SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex, int number) |
607 { | 607 { |
608 //Not supported. | 608 //Not supported. |
609 } | 609 } |
610 | 610 |
611 FX_BOOL Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) | 611 bool Field::buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
612 { | 612 { |
613 ASSERT(m_pDocument != NULL); | 613 ASSERT(m_pDocument != NULL); |
614 | 614 |
615 if (vp.IsSetting()) | 615 if (vp.IsSetting()) |
616 { | 616 { |
617 » » if (!m_bCanSet) return FALSE; | 617 » » if (!m_bCanSet) return false; |
618 | 618 |
619 int nVP; | 619 int nVP; |
620 vp >> nVP; | 620 vp >> nVP; |
621 | 621 |
622 if (m_bDelay) | 622 if (m_bDelay) |
623 { | 623 { |
624 AddDelay_Int(FP_BUTTONALIGNY, nVP); | 624 AddDelay_Int(FP_BUTTONALIGNY, nVP); |
625 } | 625 } |
626 else | 626 else |
627 { | 627 { |
628 Field::SetButtonAlignY(m_pDocument, m_FieldName, m_nForm
ControlIndex, nVP); | 628 Field::SetButtonAlignY(m_pDocument, m_FieldName, m_nForm
ControlIndex, nVP); |
629 } | 629 } |
630 } | 630 } |
631 else | 631 else |
632 { | 632 { |
633 CFX_PtrArray FieldArray; | 633 CFX_PtrArray FieldArray; |
634 GetFormFields(m_FieldName,FieldArray); | 634 GetFormFields(m_FieldName,FieldArray); |
635 » » if (FieldArray.GetSize() <= 0) return FALSE; | 635 » » if (FieldArray.GetSize() <= 0) return false; |
636 | 636 |
637 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 637 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
638 ASSERT(pFormField != NULL); | 638 ASSERT(pFormField != NULL); |
639 | 639 |
640 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 640 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
641 » » » return FALSE; | 641 » » » return false; |
642 | 642 |
643 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 643 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
644 » » if (!pFormControl)return FALSE; | 644 » » if (!pFormControl)return false; |
645 | 645 |
646 CPDF_IconFit IconFit = pFormControl->GetIconFit(); | 646 CPDF_IconFit IconFit = pFormControl->GetIconFit(); |
647 | 647 |
648 FX_FLOAT fLeft,fBottom; | 648 FX_FLOAT fLeft,fBottom; |
649 IconFit.GetIconPosition(fLeft,fBottom); | 649 IconFit.GetIconPosition(fLeft,fBottom); |
650 | 650 |
651 vp << (int32_t)fBottom; | 651 vp << (int32_t)fBottom; |
652 } | 652 } |
653 | 653 |
654 » return TRUE; | 654 » return true; |
655 } | 655 } |
656 | 656 |
657 void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex, int number) | 657 void Field::SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex, int number) |
658 { | 658 { |
659 //Not supported. | 659 //Not supported. |
660 } | 660 } |
661 | 661 |
662 FX_BOOL Field::buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr
ing& sError) | 662 bool Field::buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) |
663 { | 663 { |
664 ASSERT(m_pDocument != NULL); | 664 ASSERT(m_pDocument != NULL); |
665 | 665 |
666 if (vp.IsSetting()) | 666 if (vp.IsSetting()) |
667 { | 667 { |
668 » » if (!m_bCanSet) return FALSE; | 668 » » if (!m_bCanSet) return false; |
669 | 669 |
670 bool bVP; | 670 bool bVP; |
671 vp >> bVP; | 671 vp >> bVP; |
672 | 672 |
673 if (m_bDelay) | 673 if (m_bDelay) |
674 { | 674 { |
675 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP); | 675 AddDelay_Bool(FP_BUTTONFITBOUNDS, bVP); |
676 } | 676 } |
677 else | 677 else |
678 { | 678 { |
679 Field::SetButtonFitBounds(m_pDocument, m_FieldName, m_nF
ormControlIndex, bVP); | 679 Field::SetButtonFitBounds(m_pDocument, m_FieldName, m_nF
ormControlIndex, bVP); |
680 } | 680 } |
681 } | 681 } |
682 else | 682 else |
683 { | 683 { |
684 CFX_PtrArray FieldArray; | 684 CFX_PtrArray FieldArray; |
685 GetFormFields(m_FieldName,FieldArray); | 685 GetFormFields(m_FieldName,FieldArray); |
686 » » if (FieldArray.GetSize() <= 0) return FALSE; | 686 » » if (FieldArray.GetSize() <= 0) return false; |
687 | 687 |
688 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 688 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
689 ASSERT(pFormField != NULL); | 689 ASSERT(pFormField != NULL); |
690 | 690 |
691 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 691 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
692 » » » return FALSE; | 692 » » » return false; |
693 | 693 |
694 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 694 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
695 » » if (!pFormControl)return FALSE; | 695 » » if (!pFormControl)return false; |
696 | 696 |
697 CPDF_IconFit IconFit = pFormControl->GetIconFit(); | 697 CPDF_IconFit IconFit = pFormControl->GetIconFit(); |
698 vp << IconFit.GetFittingBounds(); | 698 vp << IconFit.GetFittingBounds(); |
699 } | 699 } |
700 | 700 |
701 » return TRUE; | 701 » return true; |
702 } | 702 } |
703 | 703 |
704 void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString
& swFieldName, int nControlIndex, bool b) | 704 void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString
& swFieldName, int nControlIndex, bool b) |
705 { | 705 { |
706 //Not supported. | 706 //Not supported. |
707 } | 707 } |
708 | 708 |
709 FX_BOOL Field::buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) | 709 bool Field::buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
710 { | 710 { |
711 ASSERT(m_pDocument != NULL); | 711 ASSERT(m_pDocument != NULL); |
712 | 712 |
713 if (vp.IsSetting()) | 713 if (vp.IsSetting()) |
714 { | 714 { |
715 » » if (!m_bCanSet) return FALSE; | 715 » » if (!m_bCanSet) return false; |
716 | 716 |
717 int nVP; | 717 int nVP; |
718 vp >> nVP; | 718 vp >> nVP; |
719 | 719 |
720 if (m_bDelay) | 720 if (m_bDelay) |
721 { | 721 { |
722 AddDelay_Int(FP_BUTTONPOSITION, nVP); | 722 AddDelay_Int(FP_BUTTONPOSITION, nVP); |
723 } | 723 } |
724 else | 724 else |
725 { | 725 { |
726 Field::SetButtonPosition(m_pDocument, m_FieldName, m_nFo
rmControlIndex, nVP); | 726 Field::SetButtonPosition(m_pDocument, m_FieldName, m_nFo
rmControlIndex, nVP); |
727 } | 727 } |
728 } | 728 } |
729 else | 729 else |
730 { | 730 { |
731 CFX_PtrArray FieldArray; | 731 CFX_PtrArray FieldArray; |
732 GetFormFields(m_FieldName,FieldArray); | 732 GetFormFields(m_FieldName,FieldArray); |
733 » » if (FieldArray.GetSize() <= 0) return FALSE; | 733 » » if (FieldArray.GetSize() <= 0) return false; |
734 | 734 |
735 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 735 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
736 ASSERT(pFormField != NULL); | 736 ASSERT(pFormField != NULL); |
737 | 737 |
738 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 738 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
739 » » » return FALSE; | 739 » » » return false; |
740 | 740 |
741 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 741 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
742 » » if (!pFormControl)return FALSE; | 742 » » if (!pFormControl)return false; |
743 | 743 |
744 vp << pFormControl->GetTextPosition(); | 744 vp << pFormControl->GetTextPosition(); |
745 } | 745 } |
746 » return TRUE; | 746 » return true; |
747 } | 747 } |
748 | 748 |
749 void Field::SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString&
swFieldName, int nControlIndex, int number) | 749 void Field::SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString&
swFieldName, int nControlIndex, int number) |
750 { | 750 { |
751 //Not supported. | 751 //Not supported. |
752 } | 752 } |
753 | 753 |
754 FX_BOOL Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) | 754 bool Field::buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
755 { | 755 { |
756 ASSERT(m_pDocument != NULL); | 756 ASSERT(m_pDocument != NULL); |
757 | 757 |
758 if (vp.IsSetting()) | 758 if (vp.IsSetting()) |
759 { | 759 { |
760 » » if (!m_bCanSet) return FALSE; | 760 » » if (!m_bCanSet) return false; |
761 | 761 |
762 int nVP; | 762 int nVP; |
763 vp >> nVP; | 763 vp >> nVP; |
764 | 764 |
765 if (m_bDelay) | 765 if (m_bDelay) |
766 { | 766 { |
767 AddDelay_Int(FP_BUTTONSCALEHOW, nVP); | 767 AddDelay_Int(FP_BUTTONSCALEHOW, nVP); |
768 } | 768 } |
769 else | 769 else |
770 { | 770 { |
771 Field::SetButtonScaleHow(m_pDocument, m_FieldName, m_nFo
rmControlIndex, nVP); | 771 Field::SetButtonScaleHow(m_pDocument, m_FieldName, m_nFo
rmControlIndex, nVP); |
772 } | 772 } |
773 } | 773 } |
774 else | 774 else |
775 { | 775 { |
776 CFX_PtrArray FieldArray; | 776 CFX_PtrArray FieldArray; |
777 GetFormFields(m_FieldName, FieldArray); | 777 GetFormFields(m_FieldName, FieldArray); |
778 » » if (FieldArray.GetSize() <= 0) return FALSE; | 778 » » if (FieldArray.GetSize() <= 0) return false; |
779 | 779 |
780 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 780 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
781 ASSERT(pFormField != NULL); | 781 ASSERT(pFormField != NULL); |
782 | 782 |
783 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 783 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
784 » » » return FALSE; | 784 » » » return false; |
785 | 785 |
786 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 786 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
787 » » if (!pFormControl)return FALSE; | 787 » » if (!pFormControl)return false; |
788 | 788 |
789 CPDF_IconFit IconFit = pFormControl->GetIconFit(); | 789 CPDF_IconFit IconFit = pFormControl->GetIconFit(); |
790 if (IconFit.IsProportionalScale()) | 790 if (IconFit.IsProportionalScale()) |
791 vp << (int32_t)0; | 791 vp << (int32_t)0; |
792 else | 792 else |
793 vp << (int32_t)1; | 793 vp << (int32_t)1; |
794 } | 794 } |
795 | 795 |
796 » return TRUE; | 796 » return true; |
797 } | 797 } |
798 | 798 |
799 void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString&
swFieldName, int nControlIndex, int number) | 799 void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString&
swFieldName, int nControlIndex, int number) |
800 { | 800 { |
801 //Not supported. | 801 //Not supported. |
802 } | 802 } |
803 | 803 |
804 FX_BOOL Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr
ing& sError) | 804 bool Field::buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) |
805 { | 805 { |
806 ASSERT(m_pDocument != NULL); | 806 ASSERT(m_pDocument != NULL); |
807 | 807 |
808 if (vp.IsSetting()) | 808 if (vp.IsSetting()) |
809 { | 809 { |
810 » » if (!m_bCanSet) return FALSE; | 810 » » if (!m_bCanSet) return false; |
811 | 811 |
812 int nVP; | 812 int nVP; |
813 vp >> nVP; | 813 vp >> nVP; |
814 | 814 |
815 if (m_bDelay) | 815 if (m_bDelay) |
816 { | 816 { |
817 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP); | 817 AddDelay_Int(FP_BUTTONSCALEWHEN, nVP); |
818 } | 818 } |
819 else | 819 else |
820 { | 820 { |
821 Field::SetButtonScaleWhen(m_pDocument, m_FieldName, m_nF
ormControlIndex, nVP); | 821 Field::SetButtonScaleWhen(m_pDocument, m_FieldName, m_nF
ormControlIndex, nVP); |
822 } | 822 } |
823 } | 823 } |
824 else | 824 else |
825 { | 825 { |
826 CFX_PtrArray FieldArray; | 826 CFX_PtrArray FieldArray; |
827 GetFormFields(m_FieldName,FieldArray); | 827 GetFormFields(m_FieldName,FieldArray); |
828 » » if (FieldArray.GetSize() <= 0) return FALSE; | 828 » » if (FieldArray.GetSize() <= 0) return false; |
829 | 829 |
830 CPDF_FormField* pFormField = (CPDF_FormField*) FieldArray.Elemen
tAt(0); | 830 CPDF_FormField* pFormField = (CPDF_FormField*) FieldArray.Elemen
tAt(0); |
831 ASSERT(pFormField != NULL); | 831 ASSERT(pFormField != NULL); |
832 | 832 |
833 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 833 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
834 » » » return FALSE; | 834 » » » return false; |
835 | 835 |
836 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 836 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
837 » » if (!pFormControl) return FALSE; | 837 » » if (!pFormControl) return false; |
838 | 838 |
839 CPDF_IconFit IconFit = pFormControl->GetIconFit(); | 839 CPDF_IconFit IconFit = pFormControl->GetIconFit(); |
840 int ScaleM = IconFit.GetScaleMethod(); | 840 int ScaleM = IconFit.GetScaleMethod(); |
841 switch (ScaleM) | 841 switch (ScaleM) |
842 { | 842 { |
843 case CPDF_IconFit::Always : | 843 case CPDF_IconFit::Always : |
844 vp << (int32_t) CPDF_IconFit::Always; | 844 vp << (int32_t) CPDF_IconFit::Always; |
845 break; | 845 break; |
846 case CPDF_IconFit::Bigger : | 846 case CPDF_IconFit::Bigger : |
847 vp << (int32_t) CPDF_IconFit::Bigger; | 847 vp << (int32_t) CPDF_IconFit::Bigger; |
848 break; | 848 break; |
849 case CPDF_IconFit::Never : | 849 case CPDF_IconFit::Never : |
850 vp << (int32_t) CPDF_IconFit::Never; | 850 vp << (int32_t) CPDF_IconFit::Never; |
851 break; | 851 break; |
852 case CPDF_IconFit::Smaller : | 852 case CPDF_IconFit::Smaller : |
853 vp << (int32_t) CPDF_IconFit::Smaller; | 853 vp << (int32_t) CPDF_IconFit::Smaller; |
854 break; | 854 break; |
855 } | 855 } |
856 } | 856 } |
857 | 857 |
858 » return TRUE; | 858 » return true; |
859 } | 859 } |
860 | 860 |
861 void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString
& swFieldName, int nControlIndex, int number) | 861 void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString
& swFieldName, int nControlIndex, int number) |
862 { | 862 { |
863 //Not supported. | 863 //Not supported. |
864 } | 864 } |
865 | 865 |
866 FX_BOOL Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) | 866 bool Field::calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
867 { | 867 { |
868 ASSERT(m_pDocument != NULL); | 868 ASSERT(m_pDocument != NULL); |
869 | 869 |
870 if (vp.IsSetting()) | 870 if (vp.IsSetting()) |
871 { | 871 { |
872 » » if (!m_bCanSet) return FALSE; | 872 » » if (!m_bCanSet) return false; |
873 | 873 |
874 int nVP; | 874 int nVP; |
875 vp >> nVP; | 875 vp >> nVP; |
876 | 876 |
877 if (m_bDelay) | 877 if (m_bDelay) |
878 { | 878 { |
879 AddDelay_Int(FP_CALCORDERINDEX, nVP); | 879 AddDelay_Int(FP_CALCORDERINDEX, nVP); |
880 } | 880 } |
881 else | 881 else |
882 { | 882 { |
883 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFo
rmControlIndex, nVP); | 883 Field::SetCalcOrderIndex(m_pDocument, m_FieldName, m_nFo
rmControlIndex, nVP); |
884 } | 884 } |
885 } | 885 } |
886 else | 886 else |
887 { | 887 { |
888 CFX_PtrArray FieldArray; | 888 CFX_PtrArray FieldArray; |
889 GetFormFields(m_FieldName, FieldArray); | 889 GetFormFields(m_FieldName, FieldArray); |
890 » » if (FieldArray.GetSize() <= 0) return FALSE; | 890 » » if (FieldArray.GetSize() <= 0) return false; |
891 | 891 |
892 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 892 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
893 ASSERT(pFormField != NULL); | 893 ASSERT(pFormField != NULL); |
894 | 894 |
895 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormFie
ld->GetFieldType() != FIELDTYPE_TEXTFIELD) | 895 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormFie
ld->GetFieldType() != FIELDTYPE_TEXTFIELD) |
896 » » » return FALSE; | 896 » » » return false; |
897 | 897 |
898 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); | 898 CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm(); |
899 ASSERT(pRDInterForm != NULL); | 899 ASSERT(pRDInterForm != NULL); |
900 | 900 |
901 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); | 901 CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); |
902 ASSERT(pInterForm != NULL); | 902 ASSERT(pInterForm != NULL); |
903 | 903 |
904 vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormFiel
d); | 904 vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormFiel
d); |
905 } | 905 } |
906 | 906 |
907 » return TRUE; | 907 » return true; |
908 } | 908 } |
909 | 909 |
910 void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString&
swFieldName, int nControlIndex, int number) | 910 void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString&
swFieldName, int nControlIndex, int number) |
911 { | 911 { |
912 //Not supported. | 912 //Not supported. |
913 } | 913 } |
914 | 914 |
915 FX_BOOL Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 915 bool Field::charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
916 { | 916 { |
917 ASSERT(m_pDocument != NULL); | 917 ASSERT(m_pDocument != NULL); |
918 | 918 |
919 if (vp.IsSetting()) | 919 if (vp.IsSetting()) |
920 { | 920 { |
921 » » if (!m_bCanSet) return FALSE; | 921 » » if (!m_bCanSet) return false; |
922 | 922 |
923 int nVP; | 923 int nVP; |
924 vp >> nVP; | 924 vp >> nVP; |
925 | 925 |
926 if (m_bDelay) | 926 if (m_bDelay) |
927 { | 927 { |
928 AddDelay_Int(FP_CHARLIMIT, nVP); | 928 AddDelay_Int(FP_CHARLIMIT, nVP); |
929 } | 929 } |
930 else | 930 else |
931 { | 931 { |
932 Field::SetCharLimit(m_pDocument, m_FieldName, m_nFormCon
trolIndex, nVP); | 932 Field::SetCharLimit(m_pDocument, m_FieldName, m_nFormCon
trolIndex, nVP); |
933 } | 933 } |
934 } | 934 } |
935 else | 935 else |
936 { | 936 { |
937 CFX_PtrArray FieldArray; | 937 CFX_PtrArray FieldArray; |
938 GetFormFields(m_FieldName, FieldArray); | 938 GetFormFields(m_FieldName, FieldArray); |
939 » » if (FieldArray.GetSize() <= 0) return FALSE; | 939 » » if (FieldArray.GetSize() <= 0) return false; |
940 | 940 |
941 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 941 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
942 ASSERT(pFormField != NULL); | 942 ASSERT(pFormField != NULL); |
943 | 943 |
944 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 944 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
945 » » » return FALSE; | 945 » » » return false; |
946 | 946 |
947 vp << (int32_t)pFormField->GetMaxLen(); | 947 vp << (int32_t)pFormField->GetMaxLen(); |
948 } | 948 } |
949 » return TRUE; | 949 » return true; |
950 } | 950 } |
951 | 951 |
952 void Field::SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, int number) | 952 void Field::SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, int number) |
953 { | 953 { |
954 //Not supported. | 954 //Not supported. |
955 } | 955 } |
956 | 956 |
957 FX_BOOL Field::comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError
) | 957 bool Field::comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
958 { | 958 { |
959 ASSERT(m_pDocument != NULL); | 959 ASSERT(m_pDocument != NULL); |
960 | 960 |
961 if (vp.IsSetting()) | 961 if (vp.IsSetting()) |
962 { | 962 { |
963 » » if (!m_bCanSet) return FALSE; | 963 » » if (!m_bCanSet) return false; |
964 | 964 |
965 bool bVP; | 965 bool bVP; |
966 vp >> bVP; | 966 vp >> bVP; |
967 | 967 |
968 if (m_bDelay) | 968 if (m_bDelay) |
969 { | 969 { |
970 AddDelay_Bool(FP_COMB, bVP); | 970 AddDelay_Bool(FP_COMB, bVP); |
971 } | 971 } |
972 else | 972 else |
973 { | 973 { |
974 Field::SetComb(m_pDocument, m_FieldName, m_nFormControlI
ndex, bVP); | 974 Field::SetComb(m_pDocument, m_FieldName, m_nFormControlI
ndex, bVP); |
975 } | 975 } |
976 } | 976 } |
977 else | 977 else |
978 { | 978 { |
979 CFX_PtrArray FieldArray; | 979 CFX_PtrArray FieldArray; |
980 GetFormFields(m_FieldName,FieldArray); | 980 GetFormFields(m_FieldName,FieldArray); |
981 » » if (FieldArray.GetSize() <= 0) return FALSE; | 981 » » if (FieldArray.GetSize() <= 0) return false; |
982 | 982 |
983 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 983 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
984 ASSERT(pFormField != NULL); | 984 ASSERT(pFormField != NULL); |
985 | 985 |
986 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 986 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
987 » » » return FALSE; | 987 » » » return false; |
988 | 988 |
989 if (pFormField->GetFieldFlags() & FIELDFLAG_COMB) | 989 if (pFormField->GetFieldFlags() & FIELDFLAG_COMB) |
990 vp << true; | 990 vp << true; |
991 else | 991 else |
992 vp << false; | 992 vp << false; |
993 } | 993 } |
994 | 994 |
995 » return TRUE; | 995 » return true; |
996 } | 996 } |
997 | 997 |
998 void Field::SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa
me, int nControlIndex, bool b) | 998 void Field::SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa
me, int nControlIndex, bool b) |
999 { | 999 { |
1000 //Not supported. | 1000 //Not supported. |
1001 } | 1001 } |
1002 | 1002 |
1003 FX_BOOL Field::commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideS
tring& sError) | 1003 bool Field::commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) |
1004 { | 1004 { |
1005 ASSERT(m_pDocument != NULL); | 1005 ASSERT(m_pDocument != NULL); |
1006 | 1006 |
1007 if (vp.IsSetting()) | 1007 if (vp.IsSetting()) |
1008 { | 1008 { |
1009 » » if (!m_bCanSet) return FALSE; | 1009 » » if (!m_bCanSet) return false; |
1010 | 1010 |
1011 bool bVP; | 1011 bool bVP; |
1012 vp >> bVP; | 1012 vp >> bVP; |
1013 | 1013 |
1014 if (m_bDelay) | 1014 if (m_bDelay) |
1015 { | 1015 { |
1016 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP); | 1016 AddDelay_Bool(FP_COMMITONSELCHANGE, bVP); |
1017 } | 1017 } |
1018 else | 1018 else |
1019 { | 1019 { |
1020 Field::SetCommitOnSelChange(m_pDocument, m_FieldName, m_
nFormControlIndex, bVP); | 1020 Field::SetCommitOnSelChange(m_pDocument, m_FieldName, m_
nFormControlIndex, bVP); |
1021 } | 1021 } |
1022 } | 1022 } |
1023 else | 1023 else |
1024 { | 1024 { |
1025 CFX_PtrArray FieldArray; | 1025 CFX_PtrArray FieldArray; |
1026 GetFormFields(m_FieldName,FieldArray); | 1026 GetFormFields(m_FieldName,FieldArray); |
1027 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1027 » » if (FieldArray.GetSize() <= 0) return false; |
1028 | 1028 |
1029 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1029 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1030 ASSERT(pFormField != NULL); | 1030 ASSERT(pFormField != NULL); |
1031 | 1031 |
1032 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormFie
ld->GetFieldType() != FIELDTYPE_LISTBOX) | 1032 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormFie
ld->GetFieldType() != FIELDTYPE_LISTBOX) |
1033 » » » return FALSE; | 1033 » » » return false; |
1034 | 1034 |
1035 if (pFormField->GetFieldFlags() & FIELDFLAG_COMMITONSELCHANGE) | 1035 if (pFormField->GetFieldFlags() & FIELDFLAG_COMMITONSELCHANGE) |
1036 vp << true; | 1036 vp << true; |
1037 else | 1037 else |
1038 vp << false; | 1038 vp << false; |
1039 } | 1039 } |
1040 | 1040 |
1041 » return TRUE; | 1041 » return true; |
1042 } | 1042 } |
1043 | 1043 |
1044 void Field::SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideStri
ng& swFieldName, int nControlIndex, bool b) | 1044 void Field::SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideStri
ng& swFieldName, int nControlIndex, bool b) |
1045 { | 1045 { |
1046 //Not supported. | 1046 //Not supported. |
1047 } | 1047 } |
1048 | 1048 |
1049 FX_BOOL Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid
eString& sError) | 1049 bool Field::currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideSt
ring& sError) |
1050 { | 1050 { |
1051 ASSERT(m_pDocument != NULL); | 1051 ASSERT(m_pDocument != NULL); |
1052 | 1052 |
1053 if (vp.IsSetting()) | 1053 if (vp.IsSetting()) |
1054 { | 1054 { |
1055 » » if (!m_bCanSet) return FALSE; | 1055 » » if (!m_bCanSet) return false; |
1056 | 1056 |
1057 CFX_DWordArray array; | 1057 CFX_DWordArray array; |
1058 | 1058 |
1059 if (vp.GetType() == VT_number) | 1059 if (vp.GetType() == VT_number) |
1060 { | 1060 { |
1061 int iSelecting = 0; | 1061 int iSelecting = 0; |
1062 vp >> iSelecting; | 1062 vp >> iSelecting; |
1063 array.Add(iSelecting); | 1063 array.Add(iSelecting); |
1064 } | 1064 } |
1065 else if (vp.IsArrayObject()) | 1065 else if (vp.IsArrayObject()) |
(...skipping 16 matching lines...) Expand all Loading... |
1082 } | 1082 } |
1083 else | 1083 else |
1084 { | 1084 { |
1085 Field::SetCurrentValueIndices(m_pDocument, m_FieldName,
m_nFormControlIndex, array); | 1085 Field::SetCurrentValueIndices(m_pDocument, m_FieldName,
m_nFormControlIndex, array); |
1086 } | 1086 } |
1087 } | 1087 } |
1088 else | 1088 else |
1089 { | 1089 { |
1090 CFX_PtrArray FieldArray; | 1090 CFX_PtrArray FieldArray; |
1091 GetFormFields(m_FieldName,FieldArray); | 1091 GetFormFields(m_FieldName,FieldArray); |
1092 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1092 » » if (FieldArray.GetSize() <= 0) return false; |
1093 | 1093 |
1094 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1094 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1095 ASSERT(pFormField != NULL); | 1095 ASSERT(pFormField != NULL); |
1096 | 1096 |
1097 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormFie
ld->GetFieldType() != FIELDTYPE_LISTBOX) | 1097 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && pFormFie
ld->GetFieldType() != FIELDTYPE_LISTBOX) |
1098 » » » return FALSE; | 1098 » » » return false; |
1099 | 1099 |
1100 if (pFormField->CountSelectedItems() == 1) | 1100 if (pFormField->CountSelectedItems() == 1) |
1101 vp << pFormField->GetSelectedIndex(0); | 1101 vp << pFormField->GetSelectedIndex(0); |
1102 else if (pFormField->CountSelectedItems() > 1) | 1102 else if (pFormField->CountSelectedItems() > 1) |
1103 { | 1103 { |
1104 CJS_Array SelArray(m_isolate); | 1104 CJS_Array SelArray(m_isolate); |
1105 for (int i=0,sz=pFormField->CountSelectedItems(); i<sz;
i++) | 1105 for (int i=0,sz=pFormField->CountSelectedItems(); i<sz;
i++) |
1106 { | 1106 { |
1107 SelArray.SetElement(i, CJS_Value(m_isolate,pForm
Field->GetSelectedIndex(i))); | 1107 SelArray.SetElement(i, CJS_Value(m_isolate,pForm
Field->GetSelectedIndex(i))); |
1108 } | 1108 } |
1109 vp << SelArray; | 1109 vp << SelArray; |
1110 } | 1110 } |
1111 else | 1111 else |
1112 vp << -1; | 1112 vp << -1; |
1113 } | 1113 } |
1114 | 1114 |
1115 » return TRUE; | 1115 » return true; |
1116 } | 1116 } |
1117 | 1117 |
1118 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt
ring& swFieldName, int nControlIndex, | 1118 void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideSt
ring& swFieldName, int nControlIndex, |
1119 const CFX_DWo
rdArray& array) | 1119 const CFX_DWo
rdArray& array) |
1120 { | 1120 { |
1121 ASSERT(pDocument != NULL); | 1121 ASSERT(pDocument != NULL); |
1122 | 1122 |
1123 CFX_PtrArray FieldArray; | 1123 CFX_PtrArray FieldArray; |
1124 GetFormFields(pDocument, swFieldName, FieldArray); | 1124 GetFormFields(pDocument, swFieldName, FieldArray); |
1125 | 1125 |
1126 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 1126 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
1127 { | 1127 { |
1128 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 1128 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
1129 ASSERT(pFormField != NULL); | 1129 ASSERT(pFormField != NULL); |
1130 | 1130 |
1131 int nFieldType = pFormField->GetFieldType(); | 1131 int nFieldType = pFormField->GetFieldType(); |
1132 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_
LISTBOX) | 1132 if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_
LISTBOX) |
1133 { | 1133 { |
1134 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags(); | 1134 FX_DWORD dwFieldFlags = pFormField->GetFieldFlags(); |
1135 » » » pFormField->ClearSelection(TRUE); | 1135 » » » pFormField->ClearSelection(true); |
1136 | 1136 |
1137 for (int i=0,sz=array.GetSize(); i<sz; i++) | 1137 for (int i=0,sz=array.GetSize(); i<sz; i++) |
1138 { | 1138 { |
1139 if (i>0 && !(dwFieldFlags & (1<<21))) | 1139 if (i>0 && !(dwFieldFlags & (1<<21))) |
1140 { | 1140 { |
1141 break; | 1141 break; |
1142 } | 1142 } |
1143 | 1143 |
1144 int iSelecting = (int32_t)array.GetAt(i); | 1144 int iSelecting = (int32_t)array.GetAt(i); |
1145 if (iSelecting < pFormField->CountOptions() && !
pFormField->IsItemSelected(iSelecting)) | 1145 if (iSelecting < pFormField->CountOptions() && !
pFormField->IsItemSelected(iSelecting)) |
1146 » » » » » pFormField->SetItemSelection(iSelecting,
TRUE); | 1146 » » » » » pFormField->SetItemSelection(iSelecting,
true); |
1147 | 1147 |
1148 } | 1148 } |
1149 » » » UpdateFormField(pDocument, pFormField, TRUE, TRUE, TRUE)
; | 1149 » » » UpdateFormField(pDocument, pFormField, true, true, true)
; |
1150 } | 1150 } |
1151 } | 1151 } |
1152 } | 1152 } |
1153 | 1153 |
1154 FX_BOOL Field::defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) | 1154 bool Field::defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1155 { | 1155 { |
1156 // MQG sError = JSGetStringFromID(IDS_STRING_NOTSUPPORT); | 1156 // MQG sError = JSGetStringFromID(IDS_STRING_NOTSUPPORT); |
1157 » return FALSE; | 1157 » return false; |
1158 | 1158 |
1159 if (vp.IsSetting()) | 1159 if (vp.IsSetting()) |
1160 { | 1160 { |
1161 » » if (!m_bCanSet) return FALSE; | 1161 » » if (!m_bCanSet) return false; |
1162 | 1162 |
1163 ; | 1163 ; |
1164 } | 1164 } |
1165 else | 1165 else |
1166 { | 1166 { |
1167 ; | 1167 ; |
1168 } | 1168 } |
1169 » return TRUE; | 1169 » return true; |
1170 } | 1170 } |
1171 | 1171 |
1172 void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex) | 1172 void Field::SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex) |
1173 { | 1173 { |
1174 //Not supported. | 1174 //Not supported. |
1175 } | 1175 } |
1176 | 1176 |
1177 FX_BOOL Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) | 1177 bool Field::defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1178 { | 1178 { |
1179 ASSERT(m_pDocument != NULL); | 1179 ASSERT(m_pDocument != NULL); |
1180 | 1180 |
1181 if (vp.IsSetting()) | 1181 if (vp.IsSetting()) |
1182 { | 1182 { |
1183 » » if (!m_bCanSet) return FALSE; | 1183 » » if (!m_bCanSet) return false; |
1184 | 1184 |
1185 CFX_WideString WideStr; | 1185 CFX_WideString WideStr; |
1186 vp >> WideStr; | 1186 vp >> WideStr; |
1187 | 1187 |
1188 if (m_bDelay) | 1188 if (m_bDelay) |
1189 { | 1189 { |
1190 AddDelay_WideString(FP_DEFAULTVALUE, WideStr); | 1190 AddDelay_WideString(FP_DEFAULTVALUE, WideStr); |
1191 } | 1191 } |
1192 else | 1192 else |
1193 { | 1193 { |
1194 Field::SetDefaultValue(m_pDocument, m_FieldName, m_nForm
ControlIndex, WideStr); | 1194 Field::SetDefaultValue(m_pDocument, m_FieldName, m_nForm
ControlIndex, WideStr); |
1195 } | 1195 } |
1196 } | 1196 } |
1197 else | 1197 else |
1198 { | 1198 { |
1199 CFX_PtrArray FieldArray; | 1199 CFX_PtrArray FieldArray; |
1200 GetFormFields(m_FieldName,FieldArray); | 1200 GetFormFields(m_FieldName,FieldArray); |
1201 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1201 » » if (FieldArray.GetSize() <= 0) return false; |
1202 | 1202 |
1203 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1203 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1204 ASSERT(pFormField != NULL); | 1204 ASSERT(pFormField != NULL); |
1205 | 1205 |
1206 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || | 1206 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON || |
1207 pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) | 1207 pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) |
1208 » » » return FALSE; | 1208 » » » return false; |
1209 | 1209 |
1210 vp << pFormField->GetDefaultValue(); | 1210 vp << pFormField->GetDefaultValue(); |
1211 } | 1211 } |
1212 » return TRUE; | 1212 » return true; |
1213 } | 1213 } |
1214 | 1214 |
1215 void Field::SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex, | 1215 void Field::SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& s
wFieldName, int nControlIndex, |
1216 const CFX_WideString& st
ring) | 1216 const CFX_WideString& st
ring) |
1217 { | 1217 { |
1218 //Not supported. | 1218 //Not supported. |
1219 } | 1219 } |
1220 | 1220 |
1221 FX_BOOL Field::doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) | 1221 bool Field::doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
1222 { | 1222 { |
1223 ASSERT(m_pDocument != NULL); | 1223 ASSERT(m_pDocument != NULL); |
1224 | 1224 |
1225 if (vp.IsSetting()) | 1225 if (vp.IsSetting()) |
1226 { | 1226 { |
1227 » » if (!m_bCanSet) return FALSE; | 1227 » » if (!m_bCanSet) return false; |
1228 | 1228 |
1229 bool bVP; | 1229 bool bVP; |
1230 vp >> bVP; | 1230 vp >> bVP; |
1231 | 1231 |
1232 if (m_bDelay) | 1232 if (m_bDelay) |
1233 { | 1233 { |
1234 AddDelay_Bool(FP_DONOTSCROLL, bVP); | 1234 AddDelay_Bool(FP_DONOTSCROLL, bVP); |
1235 } | 1235 } |
1236 else | 1236 else |
1237 { | 1237 { |
1238 Field::SetDoNotScroll(m_pDocument, m_FieldName, m_nFormC
ontrolIndex, bVP); | 1238 Field::SetDoNotScroll(m_pDocument, m_FieldName, m_nFormC
ontrolIndex, bVP); |
1239 } | 1239 } |
1240 } | 1240 } |
1241 else | 1241 else |
1242 { | 1242 { |
1243 CFX_PtrArray FieldArray; | 1243 CFX_PtrArray FieldArray; |
1244 GetFormFields(m_FieldName,FieldArray); | 1244 GetFormFields(m_FieldName,FieldArray); |
1245 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1245 » » if (FieldArray.GetSize() <= 0) return false; |
1246 | 1246 |
1247 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1247 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1248 ASSERT(pFormField != NULL); | 1248 ASSERT(pFormField != NULL); |
1249 | 1249 |
1250 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 1250 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
1251 » » » return FALSE; | 1251 » » » return false; |
1252 | 1252 |
1253 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL) | 1253 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL) |
1254 vp << true; | 1254 vp << true; |
1255 else | 1255 else |
1256 vp << false; | 1256 vp << false; |
1257 } | 1257 } |
1258 | 1258 |
1259 » return TRUE; | 1259 » return true; |
1260 } | 1260 } |
1261 | 1261 |
1262 void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& sw
FieldName, int nControlIndex, bool b) | 1262 void Field::SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& sw
FieldName, int nControlIndex, bool b) |
1263 { | 1263 { |
1264 //Not supported. | 1264 //Not supported. |
1265 } | 1265 } |
1266 | 1266 |
1267 FX_BOOL Field::doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr
ing& sError) | 1267 bool Field::doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) |
1268 { | 1268 { |
1269 ASSERT(m_pDocument != NULL); | 1269 ASSERT(m_pDocument != NULL); |
1270 | 1270 |
1271 if (vp.IsSetting()) | 1271 if (vp.IsSetting()) |
1272 { | 1272 { |
1273 » » if (!m_bCanSet) return FALSE; | 1273 » » if (!m_bCanSet) return false; |
1274 | 1274 |
1275 bool bVP; | 1275 bool bVP; |
1276 vp >> bVP; | 1276 vp >> bVP; |
1277 } | 1277 } |
1278 else | 1278 else |
1279 { | 1279 { |
1280 CFX_PtrArray FieldArray; | 1280 CFX_PtrArray FieldArray; |
1281 GetFormFields(m_FieldName,FieldArray); | 1281 GetFormFields(m_FieldName,FieldArray); |
1282 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1282 » » if (FieldArray.GetSize() <= 0) return false; |
1283 | 1283 |
1284 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1284 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1285 ASSERT(pFormField != NULL); | 1285 ASSERT(pFormField != NULL); |
1286 | 1286 |
1287 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD && | 1287 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD && |
1288 pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) | 1288 pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) |
1289 » » » return FALSE; | 1289 » » » return false; |
1290 | 1290 |
1291 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSPELLCHECK) | 1291 if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSPELLCHECK) |
1292 vp << true; | 1292 vp << true; |
1293 else | 1293 else |
1294 vp << false; | 1294 vp << false; |
1295 } | 1295 } |
1296 | 1296 |
1297 » return TRUE; | 1297 » return true; |
1298 } | 1298 } |
1299 | 1299 |
1300 void Field::SetDelay(FX_BOOL bDelay) | 1300 void Field::SetDelay(bool bDelay) |
1301 { | 1301 { |
1302 m_bDelay = bDelay; | 1302 m_bDelay = bDelay; |
1303 | 1303 |
1304 if (!m_bDelay) | 1304 if (!m_bDelay) |
1305 { | 1305 { |
1306 if (m_pJSDoc) | 1306 if (m_pJSDoc) |
1307 m_pJSDoc->DoFieldDelay(m_FieldName, m_nFormControlIndex)
; | 1307 m_pJSDoc->DoFieldDelay(m_FieldName, m_nFormControlIndex)
; |
1308 } | 1308 } |
1309 } | 1309 } |
1310 | 1310 |
1311 FX_BOOL Field::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) | 1311 bool Field::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
1312 { | 1312 { |
1313 if (vp.IsSetting()) | 1313 if (vp.IsSetting()) |
1314 { | 1314 { |
1315 » » if (!m_bCanSet) return FALSE; | 1315 » » if (!m_bCanSet) return false; |
1316 | 1316 |
1317 bool bVP; | 1317 bool bVP; |
1318 vp >> bVP; | 1318 vp >> bVP; |
1319 | 1319 |
1320 SetDelay(bVP); | 1320 SetDelay(bVP); |
1321 } | 1321 } |
1322 else | 1322 else |
1323 { | 1323 { |
1324 vp << m_bDelay; | 1324 vp << m_bDelay; |
1325 } | 1325 } |
1326 » return TRUE; | 1326 » return true; |
1327 } | 1327 } |
1328 | 1328 |
1329 FX_BOOL Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) | 1329 bool Field::display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError
) |
1330 { | 1330 { |
1331 ASSERT(m_pDocument != NULL); | 1331 ASSERT(m_pDocument != NULL); |
1332 | 1332 |
1333 if (vp.IsSetting()) | 1333 if (vp.IsSetting()) |
1334 { | 1334 { |
1335 » » if (!m_bCanSet) return FALSE; | 1335 » » if (!m_bCanSet) return false; |
1336 | 1336 |
1337 int nVP; | 1337 int nVP; |
1338 vp >> nVP; | 1338 vp >> nVP; |
1339 | 1339 |
1340 if (m_bDelay) | 1340 if (m_bDelay) |
1341 { | 1341 { |
1342 AddDelay_Int(FP_DISPLAY, nVP); | 1342 AddDelay_Int(FP_DISPLAY, nVP); |
1343 } | 1343 } |
1344 else | 1344 else |
1345 { | 1345 { |
1346 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormContr
olIndex, nVP); | 1346 Field::SetDisplay(m_pDocument, m_FieldName, m_nFormContr
olIndex, nVP); |
1347 } | 1347 } |
1348 } | 1348 } |
1349 else | 1349 else |
1350 { | 1350 { |
1351 CFX_PtrArray FieldArray; | 1351 CFX_PtrArray FieldArray; |
1352 GetFormFields(m_FieldName,FieldArray); | 1352 GetFormFields(m_FieldName,FieldArray); |
1353 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1353 » » if (FieldArray.GetSize() <= 0) return false; |
1354 | 1354 |
1355 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1355 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1356 ASSERT(pFormField != NULL); | 1356 ASSERT(pFormField != NULL); |
1357 | 1357 |
1358 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); | 1358 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); |
1359 ASSERT(pInterForm != NULL); | 1359 ASSERT(pInterForm != NULL); |
1360 | 1360 |
1361 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); | 1361 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); |
1362 » » if (!pWidget)return FALSE; | 1362 » » if (!pWidget)return false; |
1363 | 1363 |
1364 FX_DWORD dwFlag = pWidget->GetFlags(); | 1364 FX_DWORD dwFlag = pWidget->GetFlags(); |
1365 | 1365 |
1366 if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) | 1366 if (ANNOTFLAG_INVISIBLE & dwFlag || ANNOTFLAG_HIDDEN & dwFlag) |
1367 { | 1367 { |
1368 vp << (int32_t)1; | 1368 vp << (int32_t)1; |
1369 } | 1369 } |
1370 else | 1370 else |
1371 { | 1371 { |
1372 if (ANNOTFLAG_PRINT & dwFlag) | 1372 if (ANNOTFLAG_PRINT & dwFlag) |
1373 { | 1373 { |
1374 if (ANNOTFLAG_NOVIEW & dwFlag) | 1374 if (ANNOTFLAG_NOVIEW & dwFlag) |
1375 { | 1375 { |
1376 vp << (int32_t)3; | 1376 vp << (int32_t)3; |
1377 } | 1377 } |
1378 else | 1378 else |
1379 { | 1379 { |
1380 vp << (int32_t)0; | 1380 vp << (int32_t)0; |
1381 } | 1381 } |
1382 } | 1382 } |
1383 else | 1383 else |
1384 { | 1384 { |
1385 vp << (int32_t)2; | 1385 vp << (int32_t)2; |
1386 } | 1386 } |
1387 } | 1387 } |
1388 } | 1388 } |
1389 | 1389 |
1390 » return TRUE; | 1390 » return true; |
1391 } | 1391 } |
1392 | 1392 |
1393 void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel
dName, int nControlIndex, int number) | 1393 void Field::SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFiel
dName, int nControlIndex, int number) |
1394 { | 1394 { |
1395 ASSERT(pDocument != NULL); | 1395 ASSERT(pDocument != NULL); |
1396 | 1396 |
1397 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 1397 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
1398 ASSERT(pInterForm != NULL); | 1398 ASSERT(pInterForm != NULL); |
1399 | 1399 |
1400 CFX_PtrArray FieldArray; | 1400 CFX_PtrArray FieldArray; |
1401 GetFormFields(pDocument, swFieldName, FieldArray); | 1401 GetFormFields(pDocument, swFieldName, FieldArray); |
1402 | 1402 |
1403 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 1403 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
1404 { | 1404 { |
1405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 1405 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
1406 ASSERT(pFormField != NULL); | 1406 ASSERT(pFormField != NULL); |
1407 | 1407 |
1408 if (nControlIndex < 0) | 1408 if (nControlIndex < 0) |
1409 { | 1409 { |
1410 » » » FX_BOOL bSet = FALSE; | 1410 » » » bool bSet = false; |
1411 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j
++) | 1411 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j
++) |
1412 { | 1412 { |
1413 CPDF_FormControl* pFormControl = pFormField->Get
Control(j); | 1413 CPDF_FormControl* pFormControl = pFormField->Get
Control(j); |
1414 ASSERT(pFormControl != NULL); | 1414 ASSERT(pFormControl != NULL); |
1415 | 1415 |
1416 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 1416 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
1417 { | 1417 { |
1418 FX_DWORD dwFlag = pWidget->GetFlags(); | 1418 FX_DWORD dwFlag = pWidget->GetFlags(); |
1419 switch (number) | 1419 switch (number) |
1420 { | 1420 { |
(...skipping 17 matching lines...) Expand all Loading... |
1438 case 3: | 1438 case 3: |
1439 dwFlag |= ANNOTFLAG_NOVIEW; | 1439 dwFlag |= ANNOTFLAG_NOVIEW; |
1440 dwFlag |= ANNOTFLAG_PRINT; | 1440 dwFlag |= ANNOTFLAG_PRINT; |
1441 dwFlag &= (~ANNOTFLAG_HIDDEN); | 1441 dwFlag &= (~ANNOTFLAG_HIDDEN); |
1442 break; | 1442 break; |
1443 } | 1443 } |
1444 | 1444 |
1445 if (dwFlag != pWidget->GetFlags()) | 1445 if (dwFlag != pWidget->GetFlags()) |
1446 { | 1446 { |
1447 pWidget->SetFlags(dwFlag); | 1447 pWidget->SetFlags(dwFlag); |
1448 » » » » » » bSet = TRUE; | 1448 » » » » » » bSet = true; |
1449 } | 1449 } |
1450 } | 1450 } |
1451 } | 1451 } |
1452 | 1452 |
1453 » » » if (bSet) UpdateFormField(pDocument, pFormField, TRUE, F
ALSE, TRUE); | 1453 » » » if (bSet) UpdateFormField(pDocument, pFormField, true, f
alse, true); |
1454 } | 1454 } |
1455 else | 1455 else |
1456 { | 1456 { |
1457 if(nControlIndex >= pFormField->CountControls()) return; | 1457 if(nControlIndex >= pFormField->CountControls()) return; |
1458 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) | 1458 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) |
1459 { | 1459 { |
1460 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 1460 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
1461 { | 1461 { |
1462 | 1462 |
1463 FX_DWORD dwFlag = pWidget->GetFlags(); | 1463 FX_DWORD dwFlag = pWidget->GetFlags(); |
(...skipping 18 matching lines...) Expand all Loading... |
1482 break; | 1482 break; |
1483 case 3: | 1483 case 3: |
1484 dwFlag |= ANNOTFLAG_NOVIEW; | 1484 dwFlag |= ANNOTFLAG_NOVIEW; |
1485 dwFlag |= ANNOTFLAG_PRINT; | 1485 dwFlag |= ANNOTFLAG_PRINT; |
1486 dwFlag &= (~ANNOTFLAG_HIDDEN); | 1486 dwFlag &= (~ANNOTFLAG_HIDDEN); |
1487 break; | 1487 break; |
1488 } | 1488 } |
1489 if (dwFlag != pWidget->GetFlags()) | 1489 if (dwFlag != pWidget->GetFlags()) |
1490 { | 1490 { |
1491 pWidget->SetFlags(dwFlag); | 1491 pWidget->SetFlags(dwFlag); |
1492 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, TRUE, FALSE, TRUE); | 1492 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, true, false, true); |
1493 } | 1493 } |
1494 } | 1494 } |
1495 } | 1495 } |
1496 } | 1496 } |
1497 } | 1497 } |
1498 } | 1498 } |
1499 | 1499 |
1500 FX_BOOL Field::doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) | 1500 bool Field::doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
1501 { | 1501 { |
1502 if (!vp.IsGetting()) { | 1502 if (!vp.IsGetting()) { |
1503 » » return FALSE; | 1503 » » return false; |
1504 } | 1504 } |
1505 vp << m_pJSDoc->GetCJSDoc(); | 1505 vp << m_pJSDoc->GetCJSDoc(); |
1506 » return TRUE; | 1506 » return true; |
1507 } | 1507 } |
1508 | 1508 |
1509 FX_BOOL Field::editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 1509 bool Field::editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
1510 { | 1510 { |
1511 ASSERT(m_pDocument != NULL); | 1511 ASSERT(m_pDocument != NULL); |
1512 if (vp.IsSetting()) | 1512 if (vp.IsSetting()) |
1513 { | 1513 { |
1514 » » if (!m_bCanSet) return FALSE; | 1514 » » if (!m_bCanSet) return false; |
1515 | 1515 |
1516 bool bVP; | 1516 bool bVP; |
1517 vp >> bVP; | 1517 vp >> bVP; |
1518 } | 1518 } |
1519 else | 1519 else |
1520 { | 1520 { |
1521 CFX_PtrArray FieldArray; | 1521 CFX_PtrArray FieldArray; |
1522 GetFormFields(m_FieldName, FieldArray); | 1522 GetFormFields(m_FieldName, FieldArray); |
1523 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1523 » » if (FieldArray.GetSize() <= 0) return false; |
1524 | 1524 |
1525 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1525 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1526 ASSERT(pFormField != NULL); | 1526 ASSERT(pFormField != NULL); |
1527 | 1527 |
1528 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) | 1528 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) |
1529 » » » return FALSE; | 1529 » » » return false; |
1530 | 1530 |
1531 if (pFormField->GetFieldFlags() & FIELDFLAG_EDIT) | 1531 if (pFormField->GetFieldFlags() & FIELDFLAG_EDIT) |
1532 vp << true; | 1532 vp << true; |
1533 else | 1533 else |
1534 vp << false; | 1534 vp << false; |
1535 } | 1535 } |
1536 | 1536 |
1537 » return TRUE; | 1537 » return true; |
1538 } | 1538 } |
1539 | 1539 |
1540 FX_BOOL Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) | 1540 bool Field::exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1541 { | 1541 { |
1542 ASSERT(m_pDocument != NULL); | 1542 ASSERT(m_pDocument != NULL); |
1543 | 1543 |
1544 CFX_PtrArray FieldArray; | 1544 CFX_PtrArray FieldArray; |
1545 GetFormFields(m_FieldName,FieldArray); | 1545 GetFormFields(m_FieldName,FieldArray); |
1546 » if (FieldArray.GetSize() <= 0) return FALSE; | 1546 » if (FieldArray.GetSize() <= 0) return false; |
1547 | 1547 |
1548 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 1548 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
1549 ASSERT(pFormField != NULL); | 1549 ASSERT(pFormField != NULL); |
1550 | 1550 |
1551 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && | 1551 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && |
1552 pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) | 1552 pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) |
1553 » » return FALSE; | 1553 » » return false; |
1554 | 1554 |
1555 if (vp.IsSetting()) | 1555 if (vp.IsSetting()) |
1556 { | 1556 { |
1557 » » if (!m_bCanSet) return FALSE; | 1557 » » if (!m_bCanSet) return false; |
1558 » » if (!vp.IsArrayObject())return FALSE; | 1558 » » if (!vp.IsArrayObject())return false; |
1559 } | 1559 } |
1560 else | 1560 else |
1561 { | 1561 { |
1562 CJS_Array ExportValusArray(m_isolate); | 1562 CJS_Array ExportValusArray(m_isolate); |
1563 | 1563 |
1564 if (m_nFormControlIndex < 0) | 1564 if (m_nFormControlIndex < 0) |
1565 { | 1565 { |
1566 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) | 1566 for (int i=0,sz=pFormField->CountControls(); i<sz; i++) |
1567 { | 1567 { |
1568 CPDF_FormControl* pFormControl = pFormField->Get
Control(i); | 1568 CPDF_FormControl* pFormControl = pFormField->Get
Control(i); |
1569 ASSERT(pFormControl != NULL); | 1569 ASSERT(pFormControl != NULL); |
1570 | 1570 |
1571 ExportValusArray.SetElement(i, CJS_Value(m_isola
te,pFormControl->GetExportValue().c_str())); | 1571 ExportValusArray.SetElement(i, CJS_Value(m_isola
te,pFormControl->GetExportValue().c_str())); |
1572 } | 1572 } |
1573 } | 1573 } |
1574 else | 1574 else |
1575 { | 1575 { |
1576 » » » if(m_nFormControlIndex >= pFormField->CountControls()) r
eturn FALSE; | 1576 » » » if(m_nFormControlIndex >= pFormField->CountControls()) r
eturn false; |
1577 CPDF_FormControl* pFormControl = pFormField->GetControl(
m_nFormControlIndex); | 1577 CPDF_FormControl* pFormControl = pFormField->GetControl(
m_nFormControlIndex); |
1578 » » » if (!pFormControl) return FALSE; | 1578 » » » if (!pFormControl) return false; |
1579 | 1579 |
1580 ExportValusArray.SetElement(0, CJS_Value(m_isolate,pForm
Control->GetExportValue().c_str())); | 1580 ExportValusArray.SetElement(0, CJS_Value(m_isolate,pForm
Control->GetExportValue().c_str())); |
1581 } | 1581 } |
1582 | 1582 |
1583 vp << ExportValusArray; | 1583 vp << ExportValusArray; |
1584 } | 1584 } |
1585 | 1585 |
1586 » return TRUE; | 1586 » return true; |
1587 } | 1587 } |
1588 | 1588 |
1589 FX_BOOL Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) | 1589 bool Field::fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
1590 { | 1590 { |
1591 ASSERT(m_pDocument != NULL); | 1591 ASSERT(m_pDocument != NULL); |
1592 | 1592 |
1593 CFX_PtrArray FieldArray; | 1593 CFX_PtrArray FieldArray; |
1594 GetFormFields(m_FieldName, FieldArray); | 1594 GetFormFields(m_FieldName, FieldArray); |
1595 » if (FieldArray.GetSize() <= 0) return FALSE; | 1595 » if (FieldArray.GetSize() <= 0) return false; |
1596 | 1596 |
1597 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 1597 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
1598 ASSERT(pFormField != NULL); | 1598 ASSERT(pFormField != NULL); |
1599 | 1599 |
1600 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 1600 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
1601 » » return FALSE; | 1601 » » return false; |
1602 | 1602 |
1603 if (vp.IsSetting()) | 1603 if (vp.IsSetting()) |
1604 { | 1604 { |
1605 » » if (!m_bCanSet) return FALSE; | 1605 » » if (!m_bCanSet) return false; |
1606 | 1606 |
1607 bool bVP; | 1607 bool bVP; |
1608 vp >> bVP; | 1608 vp >> bVP; |
1609 | 1609 |
1610 } | 1610 } |
1611 else | 1611 else |
1612 { | 1612 { |
1613 if (pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) | 1613 if (pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) |
1614 vp << true; | 1614 vp << true; |
1615 else | 1615 else |
1616 vp << false; | 1616 vp << false; |
1617 } | 1617 } |
1618 | 1618 |
1619 » return TRUE; | 1619 » return true; |
1620 } | 1620 } |
1621 | 1621 |
1622 FX_BOOL Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 1622 bool Field::fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
1623 { | 1623 { |
1624 ASSERT(m_pDocument != NULL); | 1624 ASSERT(m_pDocument != NULL); |
1625 | 1625 |
1626 CJS_Array crArray(m_isolate); | 1626 CJS_Array crArray(m_isolate); |
1627 | 1627 |
1628 CFX_PtrArray FieldArray; | 1628 CFX_PtrArray FieldArray; |
1629 GetFormFields(m_FieldName,FieldArray); | 1629 GetFormFields(m_FieldName,FieldArray); |
1630 » if (FieldArray.GetSize() <= 0) return FALSE; | 1630 » if (FieldArray.GetSize() <= 0) return false; |
1631 | 1631 |
1632 if (vp.IsSetting()) | 1632 if (vp.IsSetting()) |
1633 { | 1633 { |
1634 » » if (!m_bCanSet) return FALSE; | 1634 » » if (!m_bCanSet) return false; |
1635 » » if (!vp.IsArrayObject()) return FALSE; | 1635 » » if (!vp.IsArrayObject()) return false; |
1636 | 1636 |
1637 vp >> crArray; | 1637 vp >> crArray; |
1638 | 1638 |
1639 CPWL_Color color; | 1639 CPWL_Color color; |
1640 color::ConvertArrayToPWLColor(crArray, color); | 1640 color::ConvertArrayToPWLColor(crArray, color); |
1641 | 1641 |
1642 if (m_bDelay) | 1642 if (m_bDelay) |
1643 { | 1643 { |
1644 AddDelay_Color(FP_FILLCOLOR, color); | 1644 AddDelay_Color(FP_FILLCOLOR, color); |
1645 } | 1645 } |
1646 else | 1646 else |
1647 { | 1647 { |
1648 Field::SetFillColor(m_pDocument, m_FieldName, m_nFormCon
trolIndex, color); | 1648 Field::SetFillColor(m_pDocument, m_FieldName, m_nFormCon
trolIndex, color); |
1649 } | 1649 } |
1650 } | 1650 } |
1651 else | 1651 else |
1652 { | 1652 { |
1653 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1653 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1654 ASSERT(pFormField != NULL); | 1654 ASSERT(pFormField != NULL); |
1655 | 1655 |
1656 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 1656 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
1657 » » if (!pFormControl)return FALSE; | 1657 » » if (!pFormControl)return false; |
1658 | 1658 |
1659 int iColorType; | 1659 int iColorType; |
1660 pFormControl->GetBackgroundColor(iColorType); | 1660 pFormControl->GetBackgroundColor(iColorType); |
1661 | 1661 |
1662 CPWL_Color color; | 1662 CPWL_Color color; |
1663 | 1663 |
1664 if (iColorType == COLORTYPE_TRANSPARENT) | 1664 if (iColorType == COLORTYPE_TRANSPARENT) |
1665 { | 1665 { |
1666 color = CPWL_Color(COLORTYPE_TRANSPARENT); | 1666 color = CPWL_Color(COLORTYPE_TRANSPARENT); |
1667 } | 1667 } |
1668 else if (iColorType == COLORTYPE_GRAY) | 1668 else if (iColorType == COLORTYPE_GRAY) |
1669 { | 1669 { |
1670 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOrig
inalBackgroundColor(0)); | 1670 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOrig
inalBackgroundColor(0)); |
1671 } | 1671 } |
1672 else if (iColorType == COLORTYPE_RGB) | 1672 else if (iColorType == COLORTYPE_RGB) |
1673 { | 1673 { |
1674 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOrigi
nalBackgroundColor(0), | 1674 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOrigi
nalBackgroundColor(0), |
1675 pFormControl->GetOriginalBackgroundColor(1), | 1675 pFormControl->GetOriginalBackgroundColor(1), |
1676 pFormControl->GetOriginalBackgroundColor(2)); | 1676 pFormControl->GetOriginalBackgroundColor(2)); |
1677 } | 1677 } |
1678 else if (iColorType == COLORTYPE_CMYK) | 1678 else if (iColorType == COLORTYPE_CMYK) |
1679 { | 1679 { |
1680 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOrig
inalBackgroundColor(0), | 1680 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOrig
inalBackgroundColor(0), |
1681 pFormControl->GetOriginalBackgroundColor(1), | 1681 pFormControl->GetOriginalBackgroundColor(1), |
1682 pFormControl->GetOriginalBackgroundColor(2), | 1682 pFormControl->GetOriginalBackgroundColor(2), |
1683 pFormControl->GetOriginalBackgroundColor(3)); | 1683 pFormControl->GetOriginalBackgroundColor(3)); |
1684 } | 1684 } |
1685 else | 1685 else |
1686 » » » return FALSE; | 1686 » » » return false; |
1687 | 1687 |
1688 color::ConvertPWLColorToArray(color, crArray); | 1688 color::ConvertPWLColorToArray(color, crArray); |
1689 vp << crArray; | 1689 vp << crArray; |
1690 } | 1690 } |
1691 | 1691 |
1692 » return TRUE; | 1692 » return true; |
1693 } | 1693 } |
1694 | 1694 |
1695 void Field::SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, const CPWL_Color& color) | 1695 void Field::SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, const CPWL_Color& color) |
1696 { | 1696 { |
1697 //Not supported. | 1697 //Not supported. |
1698 } | 1698 } |
1699 | 1699 |
1700 FX_BOOL Field::hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) | 1700 bool Field::hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
1701 { | 1701 { |
1702 ASSERT(m_pDocument != NULL); | 1702 ASSERT(m_pDocument != NULL); |
1703 | 1703 |
1704 if (vp.IsSetting()) | 1704 if (vp.IsSetting()) |
1705 { | 1705 { |
1706 » » if (!m_bCanSet) return FALSE; | 1706 » » if (!m_bCanSet) return false; |
1707 | 1707 |
1708 bool bVP; | 1708 bool bVP; |
1709 vp >> bVP; | 1709 vp >> bVP; |
1710 | 1710 |
1711 if (m_bDelay) | 1711 if (m_bDelay) |
1712 { | 1712 { |
1713 AddDelay_Bool(FP_HIDDEN, bVP); | 1713 AddDelay_Bool(FP_HIDDEN, bVP); |
1714 } | 1714 } |
1715 else | 1715 else |
1716 { | 1716 { |
1717 Field::SetHidden(m_pDocument, m_FieldName, m_nFormContro
lIndex, bVP); | 1717 Field::SetHidden(m_pDocument, m_FieldName, m_nFormContro
lIndex, bVP); |
1718 } | 1718 } |
1719 } | 1719 } |
1720 else | 1720 else |
1721 { | 1721 { |
1722 CFX_PtrArray FieldArray; | 1722 CFX_PtrArray FieldArray; |
1723 GetFormFields(m_FieldName,FieldArray); | 1723 GetFormFields(m_FieldName,FieldArray); |
1724 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1724 » » if (FieldArray.GetSize() <= 0) return false; |
1725 | 1725 |
1726 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1726 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1727 ASSERT(pFormField != NULL); | 1727 ASSERT(pFormField != NULL); |
1728 | 1728 |
1729 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); | 1729 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); |
1730 ASSERT(pInterForm != NULL); | 1730 ASSERT(pInterForm != NULL); |
1731 | 1731 |
1732 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); | 1732 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); |
1733 » » if (!pWidget) return FALSE; | 1733 » » if (!pWidget) return false; |
1734 | 1734 |
1735 FX_DWORD dwFlags = pWidget->GetFlags(); | 1735 FX_DWORD dwFlags = pWidget->GetFlags(); |
1736 | 1736 |
1737 if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) | 1737 if (ANNOTFLAG_INVISIBLE & dwFlags || ANNOTFLAG_HIDDEN & dwFlags) |
1738 { | 1738 { |
1739 vp << true; | 1739 vp << true; |
1740 } | 1740 } |
1741 else | 1741 else |
1742 vp << false; | 1742 vp << false; |
1743 } | 1743 } |
1744 | 1744 |
1745 » return TRUE; | 1745 » return true; |
1746 } | 1746 } |
1747 | 1747 |
1748 void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField
Name, int nControlIndex, bool b) | 1748 void Field::SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swField
Name, int nControlIndex, bool b) |
1749 { | 1749 { |
1750 ASSERT(pDocument != NULL); | 1750 ASSERT(pDocument != NULL); |
1751 | 1751 |
1752 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 1752 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
1753 ASSERT(pInterForm != NULL); | 1753 ASSERT(pInterForm != NULL); |
1754 | 1754 |
1755 CFX_PtrArray FieldArray; | 1755 CFX_PtrArray FieldArray; |
1756 GetFormFields(pDocument, swFieldName, FieldArray); | 1756 GetFormFields(pDocument, swFieldName, FieldArray); |
1757 | 1757 |
1758 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 1758 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
1759 { | 1759 { |
1760 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 1760 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
1761 ASSERT(pFormField != NULL); | 1761 ASSERT(pFormField != NULL); |
1762 | 1762 |
1763 if (nControlIndex < 0) | 1763 if (nControlIndex < 0) |
1764 { | 1764 { |
1765 » » » FX_BOOL bSet = FALSE; | 1765 » » » bool bSet = false; |
1766 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j
++) | 1766 for (int j=0,jsz = pFormField->CountControls(); j<jsz; j
++) |
1767 { | 1767 { |
1768 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormField->GetControl(j))) | 1768 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormField->GetControl(j))) |
1769 { | 1769 { |
1770 FX_DWORD dwFlags = pWidget->GetFlags(); | 1770 FX_DWORD dwFlags = pWidget->GetFlags(); |
1771 | 1771 |
1772 if (b) | 1772 if (b) |
1773 { | 1773 { |
1774 dwFlags &= (~ANNOTFLAG_INVISIBLE
); | 1774 dwFlags &= (~ANNOTFLAG_INVISIBLE
); |
1775 dwFlags &= (~ANNOTFLAG_NOVIEW); | 1775 dwFlags &= (~ANNOTFLAG_NOVIEW); |
1776 dwFlags |= (ANNOTFLAG_HIDDEN | A
NNOTFLAG_PRINT); | 1776 dwFlags |= (ANNOTFLAG_HIDDEN | A
NNOTFLAG_PRINT); |
1777 } | 1777 } |
1778 else | 1778 else |
1779 { | 1779 { |
1780 dwFlags &= (~ANNOTFLAG_INVISIBLE
); | 1780 dwFlags &= (~ANNOTFLAG_INVISIBLE
); |
1781 dwFlags &= (~ANNOTFLAG_HIDDEN); | 1781 dwFlags &= (~ANNOTFLAG_HIDDEN); |
1782 dwFlags &= (~ANNOTFLAG_NOVIEW); | 1782 dwFlags &= (~ANNOTFLAG_NOVIEW); |
1783 dwFlags |= ANNOTFLAG_PRINT; | 1783 dwFlags |= ANNOTFLAG_PRINT; |
1784 } | 1784 } |
1785 | 1785 |
1786 if (dwFlags != pWidget->GetFlags()) | 1786 if (dwFlags != pWidget->GetFlags()) |
1787 { | 1787 { |
1788 pWidget->SetFlags(dwFlags); | 1788 pWidget->SetFlags(dwFlags); |
1789 » » » » » » bSet = TRUE; | 1789 » » » » » » bSet = true; |
1790 } | 1790 } |
1791 } | 1791 } |
1792 } | 1792 } |
1793 | 1793 |
1794 if (bSet) | 1794 if (bSet) |
1795 » » » » UpdateFormField(pDocument, pFormField, TRUE, FAL
SE, TRUE); | 1795 » » » » UpdateFormField(pDocument, pFormField, true, fal
se, true); |
1796 } | 1796 } |
1797 else | 1797 else |
1798 { | 1798 { |
1799 if(nControlIndex >= pFormField->CountControls()) return; | 1799 if(nControlIndex >= pFormField->CountControls()) return; |
1800 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) | 1800 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) |
1801 { | 1801 { |
1802 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 1802 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
1803 { | 1803 { |
1804 FX_DWORD dwFlags = pWidget->GetFlags(); | 1804 FX_DWORD dwFlags = pWidget->GetFlags(); |
1805 | 1805 |
1806 if (b) | 1806 if (b) |
1807 { | 1807 { |
1808 dwFlags &= (~ANNOTFLAG_INVISIBLE
); | 1808 dwFlags &= (~ANNOTFLAG_INVISIBLE
); |
1809 dwFlags &= (~ANNOTFLAG_NOVIEW); | 1809 dwFlags &= (~ANNOTFLAG_NOVIEW); |
1810 dwFlags |= (ANNOTFLAG_HIDDEN | A
NNOTFLAG_PRINT); | 1810 dwFlags |= (ANNOTFLAG_HIDDEN | A
NNOTFLAG_PRINT); |
1811 } | 1811 } |
1812 else | 1812 else |
1813 { | 1813 { |
1814 dwFlags &= (~ANNOTFLAG_INVISIBLE
); | 1814 dwFlags &= (~ANNOTFLAG_INVISIBLE
); |
1815 dwFlags &= (~ANNOTFLAG_HIDDEN); | 1815 dwFlags &= (~ANNOTFLAG_HIDDEN); |
1816 dwFlags &= (~ANNOTFLAG_NOVIEW); | 1816 dwFlags &= (~ANNOTFLAG_NOVIEW); |
1817 dwFlags |= ANNOTFLAG_PRINT; | 1817 dwFlags |= ANNOTFLAG_PRINT; |
1818 } | 1818 } |
1819 | 1819 |
1820 if (dwFlags != pWidget->GetFlags()) | 1820 if (dwFlags != pWidget->GetFlags()) |
1821 { | 1821 { |
1822 pWidget->SetFlags(dwFlags); | 1822 pWidget->SetFlags(dwFlags); |
1823 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, TRUE, FALSE, TRUE); | 1823 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, true, false, true); |
1824 } | 1824 } |
1825 } | 1825 } |
1826 } | 1826 } |
1827 } | 1827 } |
1828 } | 1828 } |
1829 } | 1829 } |
1830 | 1830 |
1831 FX_BOOL Field::highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 1831 bool Field::highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
1832 { | 1832 { |
1833 ASSERT(m_pDocument != NULL); | 1833 ASSERT(m_pDocument != NULL); |
1834 | 1834 |
1835 if (vp.IsSetting()) | 1835 if (vp.IsSetting()) |
1836 { | 1836 { |
1837 » » if (!m_bCanSet) return FALSE; | 1837 » » if (!m_bCanSet) return false; |
1838 | 1838 |
1839 CFX_ByteString strMode; | 1839 CFX_ByteString strMode; |
1840 vp >> strMode; | 1840 vp >> strMode; |
1841 | 1841 |
1842 if (m_bDelay) | 1842 if (m_bDelay) |
1843 { | 1843 { |
1844 AddDelay_String(FP_HIGHLIGHT, strMode); | 1844 AddDelay_String(FP_HIGHLIGHT, strMode); |
1845 } | 1845 } |
1846 else | 1846 else |
1847 { | 1847 { |
1848 Field::SetHighlight(m_pDocument, m_FieldName, m_nFormCon
trolIndex, strMode); | 1848 Field::SetHighlight(m_pDocument, m_FieldName, m_nFormCon
trolIndex, strMode); |
1849 } | 1849 } |
1850 } | 1850 } |
1851 else | 1851 else |
1852 { | 1852 { |
1853 CFX_PtrArray FieldArray; | 1853 CFX_PtrArray FieldArray; |
1854 GetFormFields(m_FieldName,FieldArray); | 1854 GetFormFields(m_FieldName,FieldArray); |
1855 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1855 » » if (FieldArray.GetSize() <= 0) return false; |
1856 | 1856 |
1857 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1857 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1858 ASSERT(pFormField != NULL); | 1858 ASSERT(pFormField != NULL); |
1859 | 1859 |
1860 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 1860 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
1861 » » » return FALSE; | 1861 » » » return false; |
1862 | 1862 |
1863 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 1863 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
1864 » » if (!pFormControl) return FALSE; | 1864 » » if (!pFormControl) return false; |
1865 | 1865 |
1866 int eHM = pFormControl->GetHighlightingMode(); | 1866 int eHM = pFormControl->GetHighlightingMode(); |
1867 switch (eHM) | 1867 switch (eHM) |
1868 { | 1868 { |
1869 case CPDF_FormControl::None: | 1869 case CPDF_FormControl::None: |
1870 vp << L"none"; | 1870 vp << L"none"; |
1871 break; | 1871 break; |
1872 case CPDF_FormControl::Push: | 1872 case CPDF_FormControl::Push: |
1873 vp << L"push"; | 1873 vp << L"push"; |
1874 break; | 1874 break; |
1875 case CPDF_FormControl::Invert: | 1875 case CPDF_FormControl::Invert: |
1876 vp << L"invert"; | 1876 vp << L"invert"; |
1877 break; | 1877 break; |
1878 case CPDF_FormControl::Outline: | 1878 case CPDF_FormControl::Outline: |
1879 vp << L"outline"; | 1879 vp << L"outline"; |
1880 break; | 1880 break; |
1881 case CPDF_FormControl::Toggle: | 1881 case CPDF_FormControl::Toggle: |
1882 vp << L"toggle"; | 1882 vp << L"toggle"; |
1883 break; | 1883 break; |
1884 } | 1884 } |
1885 } | 1885 } |
1886 | 1886 |
1887 » return TRUE; | 1887 » return true; |
1888 } | 1888 } |
1889 | 1889 |
1890 void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, const CFX_ByteString& string) | 1890 void Field::SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, const CFX_ByteString& string) |
1891 { | 1891 { |
1892 //Not supported. | 1892 //Not supported. |
1893 } | 1893 } |
1894 | 1894 |
1895 FX_BOOL Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 1895 bool Field::lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
1896 { | 1896 { |
1897 ASSERT(m_pDocument != NULL); | 1897 ASSERT(m_pDocument != NULL); |
1898 | 1898 |
1899 if (vp.IsSetting()) | 1899 if (vp.IsSetting()) |
1900 { | 1900 { |
1901 » » if (!m_bCanSet) return FALSE; | 1901 » » if (!m_bCanSet) return false; |
1902 | 1902 |
1903 int iWidth; | 1903 int iWidth; |
1904 vp >> iWidth; | 1904 vp >> iWidth; |
1905 | 1905 |
1906 if (m_bDelay) | 1906 if (m_bDelay) |
1907 { | 1907 { |
1908 AddDelay_Int(FP_LINEWIDTH, iWidth); | 1908 AddDelay_Int(FP_LINEWIDTH, iWidth); |
1909 } | 1909 } |
1910 else | 1910 else |
1911 { | 1911 { |
1912 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormCon
trolIndex, iWidth); | 1912 Field::SetLineWidth(m_pDocument, m_FieldName, m_nFormCon
trolIndex, iWidth); |
1913 } | 1913 } |
1914 } | 1914 } |
1915 else | 1915 else |
1916 { | 1916 { |
1917 CFX_PtrArray FieldArray; | 1917 CFX_PtrArray FieldArray; |
1918 GetFormFields(m_FieldName,FieldArray); | 1918 GetFormFields(m_FieldName,FieldArray); |
1919 » » if (FieldArray.GetSize() <= 0) return FALSE; | 1919 » » if (FieldArray.GetSize() <= 0) return false; |
1920 | 1920 |
1921 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 1921 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
1922 ASSERT(pFormField != NULL); | 1922 ASSERT(pFormField != NULL); |
1923 | 1923 |
1924 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 1924 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
1925 » » if (!pFormControl) return FALSE; | 1925 » » if (!pFormControl) return false; |
1926 | 1926 |
1927 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); | 1927 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); |
1928 ASSERT(pInterForm != NULL); | 1928 ASSERT(pInterForm != NULL); |
1929 | 1929 |
1930 » » if(!pFormField->CountControls()) return FALSE; | 1930 » » if(!pFormField->CountControls()) return false; |
1931 | 1931 |
1932 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetC
ontrol(0)); | 1932 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormField->GetC
ontrol(0)); |
1933 » » if (!pWidget) return FALSE; | 1933 » » if (!pWidget) return false; |
1934 | 1934 |
1935 vp << (int32_t)pWidget->GetBorderWidth(); | 1935 vp << (int32_t)pWidget->GetBorderWidth(); |
1936 } | 1936 } |
1937 | 1937 |
1938 » return TRUE; | 1938 » return true; |
1939 } | 1939 } |
1940 | 1940 |
1941 void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, int number) | 1941 void Field::SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, int number) |
1942 { | 1942 { |
1943 ASSERT(pDocument != NULL); | 1943 ASSERT(pDocument != NULL); |
1944 | 1944 |
1945 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 1945 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
1946 ASSERT(pInterForm != NULL); | 1946 ASSERT(pInterForm != NULL); |
1947 | 1947 |
1948 CFX_PtrArray FieldArray; | 1948 CFX_PtrArray FieldArray; |
1949 GetFormFields(pDocument, swFieldName, FieldArray); | 1949 GetFormFields(pDocument, swFieldName, FieldArray); |
1950 | 1950 |
1951 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 1951 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
1952 { | 1952 { |
1953 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 1953 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
1954 ASSERT(pFormField != NULL); | 1954 ASSERT(pFormField != NULL); |
1955 | 1955 |
1956 if (nControlIndex < 0) | 1956 if (nControlIndex < 0) |
1957 { | 1957 { |
1958 » » » FX_BOOL bSet = FALSE; | 1958 » » » bool bSet = false; |
1959 for (int j=0,jsz=pFormField->CountControls(); j<jsz; j++
) | 1959 for (int j=0,jsz=pFormField->CountControls(); j<jsz; j++
) |
1960 { | 1960 { |
1961 CPDF_FormControl* pFormControl = pFormField->Get
Control(j); | 1961 CPDF_FormControl* pFormControl = pFormField->Get
Control(j); |
1962 ASSERT(pFormControl != NULL); | 1962 ASSERT(pFormControl != NULL); |
1963 | 1963 |
1964 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 1964 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
1965 { | 1965 { |
1966 if (number != pWidget->GetBorderWidth()) | 1966 if (number != pWidget->GetBorderWidth()) |
1967 { | 1967 { |
1968 pWidget->SetBorderWidth(number); | 1968 pWidget->SetBorderWidth(number); |
1969 » » » » » » bSet = TRUE; | 1969 » » » » » » bSet = true; |
1970 } | 1970 } |
1971 } | 1971 } |
1972 } | 1972 } |
1973 » » » if (bSet) UpdateFormField(pDocument, pFormField, TRUE, T
RUE, TRUE); | 1973 » » » if (bSet) UpdateFormField(pDocument, pFormField, true, t
rue, true); |
1974 } | 1974 } |
1975 else | 1975 else |
1976 { | 1976 { |
1977 if(nControlIndex >= pFormField->CountControls()) return; | 1977 if(nControlIndex >= pFormField->CountControls()) return; |
1978 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) | 1978 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) |
1979 { | 1979 { |
1980 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 1980 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
1981 { | 1981 { |
1982 if (number != pWidget->GetBorderWidth()) | 1982 if (number != pWidget->GetBorderWidth()) |
1983 { | 1983 { |
1984 pWidget->SetBorderWidth(number); | 1984 pWidget->SetBorderWidth(number); |
1985 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, TRUE, TRUE, TRUE); | 1985 » » » » » » UpdateFormControl(pDocument, pFo
rmControl, true, true, true); |
1986 } | 1986 } |
1987 } | 1987 } |
1988 } | 1988 } |
1989 } | 1989 } |
1990 } | 1990 } |
1991 } | 1991 } |
1992 | 1992 |
1993 FX_BOOL Field::multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 1993 bool Field::multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
1994 { | 1994 { |
1995 ASSERT(m_pDocument != NULL); | 1995 ASSERT(m_pDocument != NULL); |
1996 | 1996 |
1997 if (vp.IsSetting()) | 1997 if (vp.IsSetting()) |
1998 { | 1998 { |
1999 » » if (!m_bCanSet) return FALSE; | 1999 » » if (!m_bCanSet) return false; |
2000 | 2000 |
2001 bool bVP; | 2001 bool bVP; |
2002 vp >> bVP; | 2002 vp >> bVP; |
2003 | 2003 |
2004 if (m_bDelay) | 2004 if (m_bDelay) |
2005 { | 2005 { |
2006 AddDelay_Bool(FP_MULTILINE, bVP); | 2006 AddDelay_Bool(FP_MULTILINE, bVP); |
2007 } | 2007 } |
2008 else | 2008 else |
2009 { | 2009 { |
2010 Field::SetMultiline(m_pDocument, m_FieldName, m_nFormCon
trolIndex, bVP); | 2010 Field::SetMultiline(m_pDocument, m_FieldName, m_nFormCon
trolIndex, bVP); |
2011 } | 2011 } |
2012 } | 2012 } |
2013 else | 2013 else |
2014 { | 2014 { |
2015 CFX_PtrArray FieldArray; | 2015 CFX_PtrArray FieldArray; |
2016 GetFormFields(m_FieldName, FieldArray); | 2016 GetFormFields(m_FieldName, FieldArray); |
2017 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2017 » » if (FieldArray.GetSize() <= 0) return false; |
2018 | 2018 |
2019 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2019 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2020 ASSERT(pFormField != NULL); | 2020 ASSERT(pFormField != NULL); |
2021 | 2021 |
2022 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 2022 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
2023 » » » return FALSE; | 2023 » » » return false; |
2024 | 2024 |
2025 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE) | 2025 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE) |
2026 vp << true; | 2026 vp << true; |
2027 else | 2027 else |
2028 vp << false; | 2028 vp << false; |
2029 } | 2029 } |
2030 | 2030 |
2031 » return TRUE; | 2031 » return true; |
2032 } | 2032 } |
2033 | 2033 |
2034 void Field::SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, bool b) | 2034 void Field::SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, bool b) |
2035 { | 2035 { |
2036 //Not supported. | 2036 //Not supported. |
2037 } | 2037 } |
2038 | 2038 |
2039 FX_BOOL Field::multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideS
tring& sError) | 2039 bool Field::multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) |
2040 { | 2040 { |
2041 ASSERT(m_pDocument != NULL); | 2041 ASSERT(m_pDocument != NULL); |
2042 | 2042 |
2043 if (vp.IsSetting()) | 2043 if (vp.IsSetting()) |
2044 { | 2044 { |
2045 » » if (!m_bCanSet) return FALSE; | 2045 » » if (!m_bCanSet) return false; |
2046 | 2046 |
2047 bool bVP; | 2047 bool bVP; |
2048 vp >> bVP; | 2048 vp >> bVP; |
2049 | 2049 |
2050 if (m_bDelay) | 2050 if (m_bDelay) |
2051 { | 2051 { |
2052 AddDelay_Bool(FP_MULTIPLESELECTION, bVP); | 2052 AddDelay_Bool(FP_MULTIPLESELECTION, bVP); |
2053 } | 2053 } |
2054 else | 2054 else |
2055 { | 2055 { |
2056 Field::SetMultipleSelection(m_pDocument, m_FieldName, m_
nFormControlIndex, bVP); | 2056 Field::SetMultipleSelection(m_pDocument, m_FieldName, m_
nFormControlIndex, bVP); |
2057 } | 2057 } |
2058 } | 2058 } |
2059 else | 2059 else |
2060 { | 2060 { |
2061 CFX_PtrArray FieldArray; | 2061 CFX_PtrArray FieldArray; |
2062 GetFormFields(m_FieldName,FieldArray); | 2062 GetFormFields(m_FieldName,FieldArray); |
2063 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2063 » » if (FieldArray.GetSize() <= 0) return false; |
2064 | 2064 |
2065 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2065 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2066 ASSERT(pFormField != NULL); | 2066 ASSERT(pFormField != NULL); |
2067 | 2067 |
2068 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX) | 2068 if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX) |
2069 » » » return FALSE; | 2069 » » » return false; |
2070 | 2070 |
2071 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT) | 2071 if (pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT) |
2072 vp << true; | 2072 vp << true; |
2073 else | 2073 else |
2074 vp << false; | 2074 vp << false; |
2075 } | 2075 } |
2076 | 2076 |
2077 » return TRUE; | 2077 » return true; |
2078 } | 2078 } |
2079 | 2079 |
2080 void Field::SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideStri
ng& swFieldName, int nControlIndex, bool b) | 2080 void Field::SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideStri
ng& swFieldName, int nControlIndex, bool b) |
2081 { | 2081 { |
2082 //Not supported. | 2082 //Not supported. |
2083 } | 2083 } |
2084 | 2084 |
2085 FX_BOOL Field::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError
) | 2085 bool Field::name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
2086 { | 2086 { |
2087 » if (!vp.IsGetting()) return FALSE; | 2087 » if (!vp.IsGetting()) return false; |
2088 | 2088 |
2089 CFX_PtrArray FieldArray; | 2089 CFX_PtrArray FieldArray; |
2090 GetFormFields(m_FieldName, FieldArray); | 2090 GetFormFields(m_FieldName, FieldArray); |
2091 » if (FieldArray.GetSize() <= 0) return FALSE; | 2091 » if (FieldArray.GetSize() <= 0) return false; |
2092 | 2092 |
2093 vp << m_FieldName; | 2093 vp << m_FieldName; |
2094 | 2094 |
2095 » return TRUE; | 2095 » return true; |
2096 } | 2096 } |
2097 | 2097 |
2098 FX_BOOL Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2098 bool Field::numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2099 { | 2099 { |
2100 CFX_PtrArray FieldArray; | 2100 CFX_PtrArray FieldArray; |
2101 GetFormFields(m_FieldName, FieldArray); | 2101 GetFormFields(m_FieldName, FieldArray); |
2102 » if (FieldArray.GetSize() <= 0) return FALSE; | 2102 » if (FieldArray.GetSize() <= 0) return false; |
2103 | 2103 |
2104 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 2104 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
2105 ASSERT(pFormField != NULL); | 2105 ASSERT(pFormField != NULL); |
2106 | 2106 |
2107 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && | 2107 if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX && |
2108 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) | 2108 pFormField->GetFieldType() != FIELDTYPE_LISTBOX) |
2109 » » return FALSE; | 2109 » » return false; |
2110 | 2110 |
2111 » if (!vp.IsGetting()) return FALSE; | 2111 » if (!vp.IsGetting()) return false; |
2112 | 2112 |
2113 vp << (int32_t)pFormField->CountOptions(); | 2113 vp << (int32_t)pFormField->CountOptions(); |
2114 | 2114 |
2115 » return TRUE; | 2115 » return true; |
2116 } | 2116 } |
2117 | 2117 |
2118 FX_BOOL Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError
) | 2118 bool Field::page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
2119 { | 2119 { |
2120 » if (!vp.IsGetting()) return FALSE; | 2120 » if (!vp.IsGetting()) return false; |
2121 | 2121 |
2122 CFX_PtrArray FieldArray; | 2122 CFX_PtrArray FieldArray; |
2123 GetFormFields(m_FieldName, FieldArray); | 2123 GetFormFields(m_FieldName, FieldArray); |
2124 » if (FieldArray.GetSize() <= 0) return FALSE; | 2124 » if (FieldArray.GetSize() <= 0) return false; |
2125 | 2125 |
2126 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 2126 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
2127 » if (!pFormField) return FALSE; | 2127 » if (!pFormField) return false; |
2128 | 2128 |
2129 ASSERT(m_pDocument != NULL); | 2129 ASSERT(m_pDocument != NULL); |
2130 | 2130 |
2131 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 2131 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
2132 ASSERT(pInterForm != NULL); | 2132 ASSERT(pInterForm != NULL); |
2133 | 2133 |
2134 CFX_PtrArray widgetArray; | 2134 CFX_PtrArray widgetArray; |
2135 pInterForm->GetWidgets(pFormField, widgetArray); | 2135 pInterForm->GetWidgets(pFormField, widgetArray); |
2136 | 2136 |
2137 if (widgetArray.GetSize() > 0) | 2137 if (widgetArray.GetSize() > 0) |
2138 { | 2138 { |
2139 CJS_Array PageArray(m_isolate); | 2139 CJS_Array PageArray(m_isolate); |
2140 | 2140 |
2141 for (int i=0,sz=widgetArray.GetSize(); i<sz; i++) | 2141 for (int i=0,sz=widgetArray.GetSize(); i<sz; i++) |
2142 { | 2142 { |
2143 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgetArray.G
etAt(i); | 2143 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)widgetArray.G
etAt(i); |
2144 ASSERT(pWidget != NULL); | 2144 ASSERT(pWidget != NULL); |
2145 | 2145 |
2146 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 2146 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
2147 if(!pPageView) | 2147 if(!pPageView) |
2148 » » » » return FALSE; | 2148 » » » » return false; |
2149 | 2149 |
2150 PageArray.SetElement(i, CJS_Value(m_isolate,(int32_t)pPa
geView->GetPageIndex())); | 2150 PageArray.SetElement(i, CJS_Value(m_isolate,(int32_t)pPa
geView->GetPageIndex())); |
2151 } | 2151 } |
2152 | 2152 |
2153 vp << PageArray; | 2153 vp << PageArray; |
2154 } | 2154 } |
2155 else | 2155 else |
2156 { | 2156 { |
2157 vp << (int32_t) -1; | 2157 vp << (int32_t) -1; |
2158 } | 2158 } |
2159 | 2159 |
2160 » return TRUE; | 2160 » return true; |
2161 } | 2161 } |
2162 | 2162 |
2163 FX_BOOL Field::password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2163 bool Field::password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2164 { | 2164 { |
2165 ASSERT(m_pDocument != NULL); | 2165 ASSERT(m_pDocument != NULL); |
2166 | 2166 |
2167 if (vp.IsSetting()) | 2167 if (vp.IsSetting()) |
2168 { | 2168 { |
2169 » » if (!m_bCanSet) return FALSE; | 2169 » » if (!m_bCanSet) return false; |
2170 | 2170 |
2171 bool bVP; | 2171 bool bVP; |
2172 vp >> bVP; | 2172 vp >> bVP; |
2173 | 2173 |
2174 if (m_bDelay) | 2174 if (m_bDelay) |
2175 { | 2175 { |
2176 AddDelay_Bool(FP_PASSWORD, bVP); | 2176 AddDelay_Bool(FP_PASSWORD, bVP); |
2177 } | 2177 } |
2178 else | 2178 else |
2179 { | 2179 { |
2180 Field::SetPassword(m_pDocument, m_FieldName, m_nFormCont
rolIndex, bVP); | 2180 Field::SetPassword(m_pDocument, m_FieldName, m_nFormCont
rolIndex, bVP); |
2181 } | 2181 } |
2182 } | 2182 } |
2183 else | 2183 else |
2184 { | 2184 { |
2185 CFX_PtrArray FieldArray; | 2185 CFX_PtrArray FieldArray; |
2186 GetFormFields(m_FieldName,FieldArray); | 2186 GetFormFields(m_FieldName,FieldArray); |
2187 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2187 » » if (FieldArray.GetSize() <= 0) return false; |
2188 | 2188 |
2189 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2189 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2190 ASSERT(pFormField != NULL); | 2190 ASSERT(pFormField != NULL); |
2191 | 2191 |
2192 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 2192 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
2193 » » » return FALSE; | 2193 » » » return false; |
2194 | 2194 |
2195 if (pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD) | 2195 if (pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD) |
2196 vp << true; | 2196 vp << true; |
2197 else | 2197 else |
2198 vp << false; | 2198 vp << false; |
2199 } | 2199 } |
2200 | 2200 |
2201 » return TRUE; | 2201 » return true; |
2202 } | 2202 } |
2203 | 2203 |
2204 void Field::SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, bool b) | 2204 void Field::SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, bool b) |
2205 { | 2205 { |
2206 //Not supported. | 2206 //Not supported. |
2207 } | 2207 } |
2208 | 2208 |
2209 FX_BOOL Field::print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) | 2209 bool Field::print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
2210 { | 2210 { |
2211 ASSERT(m_pDocument != NULL); | 2211 ASSERT(m_pDocument != NULL); |
2212 | 2212 |
2213 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 2213 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
2214 ASSERT(pInterForm != NULL); | 2214 ASSERT(pInterForm != NULL); |
2215 | 2215 |
2216 CFX_PtrArray FieldArray; | 2216 CFX_PtrArray FieldArray; |
2217 GetFormFields(m_FieldName, FieldArray); | 2217 GetFormFields(m_FieldName, FieldArray); |
2218 » if (FieldArray.GetSize() <= 0) return FALSE; | 2218 » if (FieldArray.GetSize() <= 0) return false; |
2219 | 2219 |
2220 if (vp.IsSetting()) | 2220 if (vp.IsSetting()) |
2221 { | 2221 { |
2222 » » if (!m_bCanSet) return FALSE; | 2222 » » if (!m_bCanSet) return false; |
2223 | 2223 |
2224 bool bVP; | 2224 bool bVP; |
2225 vp >> bVP; | 2225 vp >> bVP; |
2226 | 2226 |
2227 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 2227 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
2228 { | 2228 { |
2229 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray
.ElementAt(i); | 2229 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray
.ElementAt(i); |
2230 ASSERT(pFormField != NULL); | 2230 ASSERT(pFormField != NULL); |
2231 | 2231 |
2232 if (m_nFormControlIndex < 0) | 2232 if (m_nFormControlIndex < 0) |
2233 { | 2233 { |
2234 » » » » FX_BOOL bSet = FALSE; | 2234 » » » » bool bSet = false; |
2235 for (int j=0,jsz = pFormField->CountControls();
j<jsz; j++) | 2235 for (int j=0,jsz = pFormField->CountControls();
j<jsz; j++) |
2236 { | 2236 { |
2237 if (CPDFSDK_Widget* pWidget = pInterForm
->GetWidget(pFormField->GetControl(j))) | 2237 if (CPDFSDK_Widget* pWidget = pInterForm
->GetWidget(pFormField->GetControl(j))) |
2238 { | 2238 { |
2239 FX_DWORD dwFlags = pWidget->GetF
lags(); | 2239 FX_DWORD dwFlags = pWidget->GetF
lags(); |
2240 if (bVP) | 2240 if (bVP) |
2241 dwFlags |= ANNOTFLAG_PRI
NT; | 2241 dwFlags |= ANNOTFLAG_PRI
NT; |
2242 else | 2242 else |
2243 dwFlags &= ~ANNOTFLAG_PR
INT; | 2243 dwFlags &= ~ANNOTFLAG_PR
INT; |
2244 | 2244 |
2245 if (dwFlags != pWidget->GetFlags
()) | 2245 if (dwFlags != pWidget->GetFlags
()) |
2246 { | 2246 { |
2247 pWidget->SetFlags(dwFlag
s); | 2247 pWidget->SetFlags(dwFlag
s); |
2248 » » » » » » » bSet = TRUE; | 2248 » » » » » » » bSet = true; |
2249 } | 2249 } |
2250 } | 2250 } |
2251 } | 2251 } |
2252 | 2252 |
2253 if (bSet) | 2253 if (bSet) |
2254 » » » » » UpdateFormField(m_pDocument, pFormField,
TRUE, FALSE, TRUE); | 2254 » » » » » UpdateFormField(m_pDocument, pFormField,
true, false, true); |
2255 } | 2255 } |
2256 else | 2256 else |
2257 { | 2257 { |
2258 » » » » if(m_nFormControlIndex >= pFormField->CountContr
ols()) return FALSE; | 2258 » » » » if(m_nFormControlIndex >= pFormField->CountContr
ols()) return false; |
2259 if (CPDF_FormControl* pFormControl = pFormField-
>GetControl(m_nFormControlIndex)) | 2259 if (CPDF_FormControl* pFormControl = pFormField-
>GetControl(m_nFormControlIndex)) |
2260 { | 2260 { |
2261 if (CPDFSDK_Widget* pWidget = pInterForm
->GetWidget(pFormControl)) | 2261 if (CPDFSDK_Widget* pWidget = pInterForm
->GetWidget(pFormControl)) |
2262 { | 2262 { |
2263 FX_DWORD dwFlags = pWidget->GetF
lags(); | 2263 FX_DWORD dwFlags = pWidget->GetF
lags(); |
2264 if (bVP) | 2264 if (bVP) |
2265 dwFlags |= ANNOTFLAG_PRI
NT; | 2265 dwFlags |= ANNOTFLAG_PRI
NT; |
2266 else | 2266 else |
2267 dwFlags &= ~ANNOTFLAG_PR
INT; | 2267 dwFlags &= ~ANNOTFLAG_PR
INT; |
2268 | 2268 |
2269 if (dwFlags != pWidget->GetFlags
()) | 2269 if (dwFlags != pWidget->GetFlags
()) |
2270 { | 2270 { |
2271 pWidget->SetFlags(dwFlag
s); | 2271 pWidget->SetFlags(dwFlag
s); |
2272 » » » » » » » UpdateFormControl(m_pDoc
ument, pFormField->GetControl(m_nFormControlIndex), TRUE, FALSE, TRUE); | 2272 » » » » » » » UpdateFormControl(m_pDoc
ument, pFormField->GetControl(m_nFormControlIndex), true, false, true); |
2273 } | 2273 } |
2274 } | 2274 } |
2275 } | 2275 } |
2276 } | 2276 } |
2277 } | 2277 } |
2278 } | 2278 } |
2279 else | 2279 else |
2280 { | 2280 { |
2281 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2281 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2282 ASSERT(pFormField != NULL); | 2282 ASSERT(pFormField != NULL); |
2283 | 2283 |
2284 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); | 2284 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); |
2285 » » if (!pWidget) return FALSE; | 2285 » » if (!pWidget) return false; |
2286 | 2286 |
2287 if (pWidget->GetFlags() & ANNOTFLAG_PRINT) | 2287 if (pWidget->GetFlags() & ANNOTFLAG_PRINT) |
2288 vp << true; | 2288 vp << true; |
2289 else | 2289 else |
2290 vp << false; | 2290 vp << false; |
2291 } | 2291 } |
2292 | 2292 |
2293 » return TRUE; | 2293 » return true; |
2294 } | 2294 } |
2295 | 2295 |
2296 FX_BOOL Field::radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStri
ng& sError) | 2296 bool Field::radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
2297 { | 2297 { |
2298 ASSERT(m_pDocument != NULL); | 2298 ASSERT(m_pDocument != NULL); |
2299 | 2299 |
2300 CFX_PtrArray FieldArray; | 2300 CFX_PtrArray FieldArray; |
2301 GetFormFields(m_FieldName,FieldArray); | 2301 GetFormFields(m_FieldName,FieldArray); |
2302 » if (FieldArray.GetSize() <= 0) return FALSE; | 2302 » if (FieldArray.GetSize() <= 0) return false; |
2303 | 2303 |
2304 if (vp.IsSetting()) | 2304 if (vp.IsSetting()) |
2305 { | 2305 { |
2306 » » if (!m_bCanSet) return FALSE; | 2306 » » if (!m_bCanSet) return false; |
2307 | 2307 |
2308 bool bVP; | 2308 bool bVP; |
2309 vp >> bVP; | 2309 vp >> bVP; |
2310 | 2310 |
2311 } | 2311 } |
2312 else | 2312 else |
2313 { | 2313 { |
2314 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2314 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2315 ASSERT(pFormField != NULL); | 2315 ASSERT(pFormField != NULL); |
2316 | 2316 |
2317 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) | 2317 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) |
2318 » » » return FALSE; | 2318 » » » return false; |
2319 | 2319 |
2320 if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON) | 2320 if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON) |
2321 vp << true; | 2321 vp << true; |
2322 else | 2322 else |
2323 vp << false; | 2323 vp << false; |
2324 } | 2324 } |
2325 | 2325 |
2326 » return TRUE; | 2326 » return true; |
2327 } | 2327 } |
2328 | 2328 |
2329 FX_BOOL Field::readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2329 bool Field::readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2330 { | 2330 { |
2331 ASSERT(m_pDocument != NULL); | 2331 ASSERT(m_pDocument != NULL); |
2332 | 2332 |
2333 CFX_PtrArray FieldArray; | 2333 CFX_PtrArray FieldArray; |
2334 GetFormFields(m_FieldName,FieldArray); | 2334 GetFormFields(m_FieldName,FieldArray); |
2335 » if (FieldArray.GetSize() <= 0) return FALSE; | 2335 » if (FieldArray.GetSize() <= 0) return false; |
2336 | 2336 |
2337 if (vp.IsSetting()) | 2337 if (vp.IsSetting()) |
2338 { | 2338 { |
2339 » » if (!m_bCanSet) return FALSE; | 2339 » » if (!m_bCanSet) return false; |
2340 | 2340 |
2341 bool bVP; | 2341 bool bVP; |
2342 vp >> bVP; | 2342 vp >> bVP; |
2343 | 2343 |
2344 } | 2344 } |
2345 else | 2345 else |
2346 { | 2346 { |
2347 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2347 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2348 ASSERT(pFormField != NULL); | 2348 ASSERT(pFormField != NULL); |
2349 | 2349 |
2350 if (pFormField->GetFieldFlags() & FIELDFLAG_READONLY) | 2350 if (pFormField->GetFieldFlags() & FIELDFLAG_READONLY) |
2351 vp << true; | 2351 vp << true; |
2352 else | 2352 else |
2353 vp << false; | 2353 vp << false; |
2354 } | 2354 } |
2355 | 2355 |
2356 » return TRUE; | 2356 » return true; |
2357 } | 2357 } |
2358 | 2358 |
2359 FX_BOOL Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError
) | 2359 bool Field::rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
2360 { | 2360 { |
2361 ASSERT(m_pDocument != NULL); | 2361 ASSERT(m_pDocument != NULL); |
2362 | 2362 |
2363 if (vp.IsSetting()) | 2363 if (vp.IsSetting()) |
2364 { | 2364 { |
2365 » » if (!m_bCanSet) return FALSE; | 2365 » » if (!m_bCanSet) return false; |
2366 » » if (!vp.IsArrayObject())return FALSE; | 2366 » » if (!vp.IsArrayObject())return false; |
2367 | 2367 |
2368 CJS_Array rcArray(m_isolate); | 2368 CJS_Array rcArray(m_isolate); |
2369 vp >> rcArray; | 2369 vp >> rcArray; |
2370 CJS_Value Upper_Leftx(m_isolate), Upper_Lefty(m_isolate), Lower_
Rightx(m_isolate), Lower_Righty(m_isolate); | 2370 CJS_Value Upper_Leftx(m_isolate), Upper_Lefty(m_isolate), Lower_
Rightx(m_isolate), Lower_Righty(m_isolate); |
2371 rcArray.GetElement(0, Upper_Leftx); | 2371 rcArray.GetElement(0, Upper_Leftx); |
2372 rcArray.GetElement(1, Upper_Lefty); | 2372 rcArray.GetElement(1, Upper_Lefty); |
2373 rcArray.GetElement(2, Lower_Rightx); | 2373 rcArray.GetElement(2, Lower_Rightx); |
2374 rcArray.GetElement(3, Lower_Righty); | 2374 rcArray.GetElement(3, Lower_Righty); |
2375 | 2375 |
2376 FX_FLOAT pArray[4] = {0.0f,0.0f,0.0f,0.0f}; | 2376 FX_FLOAT pArray[4] = {0.0f,0.0f,0.0f,0.0f}; |
(...skipping 10 matching lines...) Expand all Loading... |
2387 } | 2387 } |
2388 else | 2388 else |
2389 { | 2389 { |
2390 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlI
ndex, crRect); | 2390 Field::SetRect(m_pDocument, m_FieldName, m_nFormControlI
ndex, crRect); |
2391 } | 2391 } |
2392 } | 2392 } |
2393 else | 2393 else |
2394 { | 2394 { |
2395 CFX_PtrArray FieldArray; | 2395 CFX_PtrArray FieldArray; |
2396 GetFormFields(m_FieldName,FieldArray); | 2396 GetFormFields(m_FieldName,FieldArray); |
2397 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2397 » » if (FieldArray.GetSize() <= 0) return false; |
2398 | 2398 |
2399 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2399 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2400 ASSERT(pFormField != NULL); | 2400 ASSERT(pFormField != NULL); |
2401 | 2401 |
2402 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); | 2402 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument-
>GetInterForm(); |
2403 ASSERT(pInterForm != NULL); | 2403 ASSERT(pInterForm != NULL); |
2404 | 2404 |
2405 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); | 2405 CPDFSDK_Widget* pWidget = pInterForm->GetWidget(GetSmartFieldCon
trol(pFormField)); |
2406 » » if (!pWidget) return FALSE; | 2406 » » if (!pWidget) return false; |
2407 | 2407 |
2408 CFX_FloatRect crRect = pWidget->GetRect(); | 2408 CFX_FloatRect crRect = pWidget->GetRect(); |
2409 CJS_Value Upper_Leftx(m_isolate),Upper_Lefty(m_isolate),Lower_Ri
ghtx(m_isolate),Lower_Righty(m_isolate); | 2409 CJS_Value Upper_Leftx(m_isolate),Upper_Lefty(m_isolate),Lower_Ri
ghtx(m_isolate),Lower_Righty(m_isolate); |
2410 Upper_Leftx = (int32_t)crRect.left; | 2410 Upper_Leftx = (int32_t)crRect.left; |
2411 Upper_Lefty = (int32_t)crRect.top; | 2411 Upper_Lefty = (int32_t)crRect.top; |
2412 Lower_Rightx = (int32_t)crRect.right; | 2412 Lower_Rightx = (int32_t)crRect.right; |
2413 Lower_Righty = (int32_t)crRect.bottom; | 2413 Lower_Righty = (int32_t)crRect.bottom; |
2414 | 2414 |
2415 CJS_Array rcArray(m_isolate); | 2415 CJS_Array rcArray(m_isolate); |
2416 rcArray.SetElement(0,Upper_Leftx); | 2416 rcArray.SetElement(0,Upper_Leftx); |
2417 rcArray.SetElement(1,Upper_Lefty); | 2417 rcArray.SetElement(1,Upper_Lefty); |
2418 rcArray.SetElement(2,Lower_Rightx); | 2418 rcArray.SetElement(2,Lower_Rightx); |
2419 rcArray.SetElement(3,Lower_Righty); | 2419 rcArray.SetElement(3,Lower_Righty); |
2420 | 2420 |
2421 vp << rcArray; | 2421 vp << rcArray; |
2422 } | 2422 } |
2423 | 2423 |
2424 » return TRUE; | 2424 » return true; |
2425 } | 2425 } |
2426 | 2426 |
2427 void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa
me, int nControlIndex, const CPDF_Rect& rect) | 2427 void Field::SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldNa
me, int nControlIndex, const CPDF_Rect& rect) |
2428 { | 2428 { |
2429 ASSERT(pDocument != NULL); | 2429 ASSERT(pDocument != NULL); |
2430 | 2430 |
2431 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 2431 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
2432 ASSERT(pInterForm != NULL); | 2432 ASSERT(pInterForm != NULL); |
2433 | 2433 |
2434 CFX_PtrArray FieldArray; | 2434 CFX_PtrArray FieldArray; |
2435 GetFormFields(pDocument, swFieldName, FieldArray); | 2435 GetFormFields(pDocument, swFieldName, FieldArray); |
2436 | 2436 |
2437 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 2437 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
2438 { | 2438 { |
2439 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 2439 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
2440 ASSERT(pFormField != NULL); | 2440 ASSERT(pFormField != NULL); |
2441 | 2441 |
2442 if (nControlIndex < 0) | 2442 if (nControlIndex < 0) |
2443 { | 2443 { |
2444 » » » FX_BOOL bSet = FALSE; | 2444 » » » bool bSet = false; |
2445 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) | 2445 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) |
2446 { | 2446 { |
2447 CPDF_FormControl* pFormControl = pFormField->Get
Control(i); | 2447 CPDF_FormControl* pFormControl = pFormField->Get
Control(i); |
2448 ASSERT(pFormControl != NULL); | 2448 ASSERT(pFormControl != NULL); |
2449 | 2449 |
2450 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 2450 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
2451 { | 2451 { |
2452 CPDF_Rect crRect = rect; | 2452 CPDF_Rect crRect = rect; |
2453 | 2453 |
2454 CPDF_Page* pPDFPage = pWidget->GetPDFPag
e(); | 2454 CPDF_Page* pPDFPage = pWidget->GetPDFPag
e(); |
2455 ASSERT(pPDFPage != NULL); | 2455 ASSERT(pPDFPage != NULL); |
2456 | 2456 |
2457 // CPDF_Page* pPDFPage = pPage->GetPage(); | 2457 // CPDF_Page* pPDFPage = pPage->GetPage(); |
2458 // ASSERT(pPDFPage != NULL); | 2458 // ASSERT(pPDFPage != NULL); |
2459 | 2459 |
2460 crRect.Intersect(pPDFPage->GetPageBBox()
); | 2460 crRect.Intersect(pPDFPage->GetPageBBox()
); |
2461 | 2461 |
2462 if (!crRect.IsEmpty()) | 2462 if (!crRect.IsEmpty()) |
2463 { | 2463 { |
2464 CPDF_Rect rcOld = pWidget->GetRe
ct(); | 2464 CPDF_Rect rcOld = pWidget->GetRe
ct(); |
2465 if (crRect.left != rcOld.left || | 2465 if (crRect.left != rcOld.left || |
2466 crRect.right != rcOld.ri
ght || | 2466 crRect.right != rcOld.ri
ght || |
2467 crRect.top != rcOld.top
|| | 2467 crRect.top != rcOld.top
|| |
2468 crRect.bottom != rcOld.b
ottom) | 2468 crRect.bottom != rcOld.b
ottom) |
2469 { | 2469 { |
2470 pWidget->SetRect(crRect)
; | 2470 pWidget->SetRect(crRect)
; |
2471 » » » » » » » bSet = TRUE; | 2471 » » » » » » » bSet = true; |
2472 } | 2472 } |
2473 } | 2473 } |
2474 } | 2474 } |
2475 } | 2475 } |
2476 | 2476 |
2477 » » » if (bSet) UpdateFormField(pDocument, pFormField, TRUE, T
RUE, TRUE); | 2477 » » » if (bSet) UpdateFormField(pDocument, pFormField, true, t
rue, true); |
2478 } | 2478 } |
2479 else | 2479 else |
2480 { | 2480 { |
2481 if(nControlIndex >= pFormField->CountControls()) return; | 2481 if(nControlIndex >= pFormField->CountControls()) return; |
2482 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) | 2482 if (CPDF_FormControl* pFormControl = pFormField->GetCont
rol(nControlIndex)) |
2483 { | 2483 { |
2484 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) | 2484 if (CPDFSDK_Widget* pWidget = pInterForm->GetWid
get(pFormControl)) |
2485 { | 2485 { |
2486 CPDF_Rect crRect = rect; | 2486 CPDF_Rect crRect = rect; |
2487 | 2487 |
2488 CPDF_Page* pPDFPage = pWidget->GetPDFPag
e(); | 2488 CPDF_Page* pPDFPage = pWidget->GetPDFPag
e(); |
2489 ASSERT(pPDFPage != NULL); | 2489 ASSERT(pPDFPage != NULL); |
2490 | 2490 |
2491 // CPDF_Page* pPDFPage = pPage->GetPage(); | 2491 // CPDF_Page* pPDFPage = pPage->GetPage(); |
2492 // ASSERT(pPDFPage != NULL); | 2492 // ASSERT(pPDFPage != NULL); |
2493 | 2493 |
2494 crRect.Intersect(pPDFPage->GetPageBBox()
); | 2494 crRect.Intersect(pPDFPage->GetPageBBox()
); |
2495 | 2495 |
2496 if (!crRect.IsEmpty()) | 2496 if (!crRect.IsEmpty()) |
2497 { | 2497 { |
2498 CPDF_Rect rcOld = pWidget->GetRe
ct(); | 2498 CPDF_Rect rcOld = pWidget->GetRe
ct(); |
2499 if (crRect.left != rcOld.left || | 2499 if (crRect.left != rcOld.left || |
2500 crRect.right != rcOld.ri
ght || | 2500 crRect.right != rcOld.ri
ght || |
2501 crRect.top != rcOld.top
|| | 2501 crRect.top != rcOld.top
|| |
2502 crRect.bottom != rcOld.b
ottom) | 2502 crRect.bottom != rcOld.b
ottom) |
2503 { | 2503 { |
2504 pWidget->SetRect(crRect)
; | 2504 pWidget->SetRect(crRect)
; |
2505 » » » » » » » UpdateFormControl(pDocum
ent, pFormControl, TRUE, TRUE, TRUE); | 2505 » » » » » » » UpdateFormControl(pDocum
ent, pFormControl, true, true, true); |
2506 } | 2506 } |
2507 } | 2507 } |
2508 } | 2508 } |
2509 } | 2509 } |
2510 } | 2510 } |
2511 } | 2511 } |
2512 } | 2512 } |
2513 | 2513 |
2514 FX_BOOL Field::required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2514 bool Field::required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2515 { | 2515 { |
2516 ASSERT(m_pDocument != NULL); | 2516 ASSERT(m_pDocument != NULL); |
2517 | 2517 |
2518 CFX_PtrArray FieldArray; | 2518 CFX_PtrArray FieldArray; |
2519 GetFormFields(m_FieldName,FieldArray); | 2519 GetFormFields(m_FieldName,FieldArray); |
2520 » if (FieldArray.GetSize() <= 0) return FALSE; | 2520 » if (FieldArray.GetSize() <= 0) return false; |
2521 | 2521 |
2522 if (vp.IsSetting()) | 2522 if (vp.IsSetting()) |
2523 { | 2523 { |
2524 » » if (!m_bCanSet) return FALSE; | 2524 » » if (!m_bCanSet) return false; |
2525 | 2525 |
2526 | 2526 |
2527 bool bVP; | 2527 bool bVP; |
2528 vp >> bVP; | 2528 vp >> bVP; |
2529 | 2529 |
2530 } | 2530 } |
2531 else | 2531 else |
2532 { | 2532 { |
2533 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2533 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2534 ASSERT(pFormField != NULL); | 2534 ASSERT(pFormField != NULL); |
2535 | 2535 |
2536 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 2536 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
2537 » » » return FALSE; | 2537 » » » return false; |
2538 | 2538 |
2539 if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED) | 2539 if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED) |
2540 vp << true; | 2540 vp << true; |
2541 else | 2541 else |
2542 vp << false; | 2542 vp << false; |
2543 } | 2543 } |
2544 | 2544 |
2545 » return TRUE; | 2545 » return true; |
2546 } | 2546 } |
2547 | 2547 |
2548 FX_BOOL Field::richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2548 bool Field::richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2549 { | 2549 { |
2550 ASSERT(m_pDocument != NULL); | 2550 ASSERT(m_pDocument != NULL); |
2551 | 2551 |
2552 if (vp.IsSetting()) | 2552 if (vp.IsSetting()) |
2553 { | 2553 { |
2554 » » if (!m_bCanSet) return FALSE; | 2554 » » if (!m_bCanSet) return false; |
2555 | 2555 |
2556 bool bVP; | 2556 bool bVP; |
2557 vp >> bVP; | 2557 vp >> bVP; |
2558 | 2558 |
2559 if (m_bDelay) | 2559 if (m_bDelay) |
2560 { | 2560 { |
2561 AddDelay_Bool(FP_RICHTEXT, bVP); | 2561 AddDelay_Bool(FP_RICHTEXT, bVP); |
2562 } | 2562 } |
2563 else | 2563 else |
2564 { | 2564 { |
2565 Field::SetRichText(m_pDocument, m_FieldName, m_nFormCont
rolIndex, bVP); | 2565 Field::SetRichText(m_pDocument, m_FieldName, m_nFormCont
rolIndex, bVP); |
2566 } | 2566 } |
2567 } | 2567 } |
2568 else | 2568 else |
2569 { | 2569 { |
2570 CFX_PtrArray FieldArray; | 2570 CFX_PtrArray FieldArray; |
2571 GetFormFields(m_FieldName,FieldArray); | 2571 GetFormFields(m_FieldName,FieldArray); |
2572 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2572 » » if (FieldArray.GetSize() <= 0) return false; |
2573 | 2573 |
2574 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2574 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2575 ASSERT(pFormField != NULL); | 2575 ASSERT(pFormField != NULL); |
2576 | 2576 |
2577 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) | 2577 if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) |
2578 » » » return FALSE; | 2578 » » » return false; |
2579 | 2579 |
2580 if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT) | 2580 if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT) |
2581 vp << true; | 2581 vp << true; |
2582 else | 2582 else |
2583 vp << false; | 2583 vp << false; |
2584 } | 2584 } |
2585 | 2585 |
2586 » return TRUE; | 2586 » return true; |
2587 } | 2587 } |
2588 | 2588 |
2589 void Field::SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, bool b) | 2589 void Field::SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, bool b) |
2590 { | 2590 { |
2591 //Not supported. | 2591 //Not supported. |
2592 } | 2592 } |
2593 | 2593 |
2594 FX_BOOL Field::richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 2594 bool Field::richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
2595 { | 2595 { |
2596 » return TRUE; | 2596 » return true; |
2597 if (vp.IsSetting()) | 2597 if (vp.IsSetting()) |
2598 { | 2598 { |
2599 » » if (!m_bCanSet) return FALSE; | 2599 » » if (!m_bCanSet) return false; |
2600 ; | 2600 ; |
2601 } | 2601 } |
2602 else | 2602 else |
2603 { | 2603 { |
2604 ; | 2604 ; |
2605 } | 2605 } |
2606 » return TRUE; | 2606 » return true; |
2607 } | 2607 } |
2608 | 2608 |
2609 void Field::SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex) | 2609 void Field::SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex) |
2610 { | 2610 { |
2611 //Not supported. | 2611 //Not supported. |
2612 } | 2612 } |
2613 | 2613 |
2614 FX_BOOL Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2614 bool Field::rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2615 { | 2615 { |
2616 ASSERT(m_pDocument != NULL); | 2616 ASSERT(m_pDocument != NULL); |
2617 | 2617 |
2618 if (vp.IsSetting()) | 2618 if (vp.IsSetting()) |
2619 { | 2619 { |
2620 » » if (!m_bCanSet) return FALSE; | 2620 » » if (!m_bCanSet) return false; |
2621 | 2621 |
2622 int nVP; | 2622 int nVP; |
2623 vp >> nVP; | 2623 vp >> nVP; |
2624 | 2624 |
2625 if (m_bDelay) | 2625 if (m_bDelay) |
2626 { | 2626 { |
2627 AddDelay_Int(FP_ROTATION, nVP); | 2627 AddDelay_Int(FP_ROTATION, nVP); |
2628 } | 2628 } |
2629 else | 2629 else |
2630 { | 2630 { |
2631 Field::SetRotation(m_pDocument, m_FieldName, m_nFormCont
rolIndex, nVP); | 2631 Field::SetRotation(m_pDocument, m_FieldName, m_nFormCont
rolIndex, nVP); |
2632 } | 2632 } |
2633 } | 2633 } |
2634 else | 2634 else |
2635 { | 2635 { |
2636 CFX_PtrArray FieldArray; | 2636 CFX_PtrArray FieldArray; |
2637 GetFormFields(m_FieldName,FieldArray); | 2637 GetFormFields(m_FieldName,FieldArray); |
2638 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2638 » » if (FieldArray.GetSize() <= 0) return false; |
2639 | 2639 |
2640 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2640 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2641 ASSERT(pFormField != NULL); | 2641 ASSERT(pFormField != NULL); |
2642 | 2642 |
2643 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 2643 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
2644 » » if (!pFormControl)return FALSE; | 2644 » » if (!pFormControl)return false; |
2645 | 2645 |
2646 vp << (int32_t)pFormControl->GetRotation(); | 2646 vp << (int32_t)pFormControl->GetRotation(); |
2647 } | 2647 } |
2648 | 2648 |
2649 » return TRUE; | 2649 » return true; |
2650 } | 2650 } |
2651 | 2651 |
2652 void Field::SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, int number) | 2652 void Field::SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, int number) |
2653 { | 2653 { |
2654 //Not supported. | 2654 //Not supported. |
2655 } | 2655 } |
2656 | 2656 |
2657 FX_BOOL Field::strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) | 2657 bool Field::strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
2658 { | 2658 { |
2659 ASSERT(m_pDocument != NULL); | 2659 ASSERT(m_pDocument != NULL); |
2660 | 2660 |
2661 if (vp.IsSetting()) | 2661 if (vp.IsSetting()) |
2662 { | 2662 { |
2663 » » if (!m_bCanSet) return FALSE; | 2663 » » if (!m_bCanSet) return false; |
2664 | 2664 |
2665 » » if (!vp.IsArrayObject())return FALSE; | 2665 » » if (!vp.IsArrayObject())return false; |
2666 | 2666 |
2667 CJS_Array crArray(m_isolate); | 2667 CJS_Array crArray(m_isolate); |
2668 vp >> crArray; | 2668 vp >> crArray; |
2669 | 2669 |
2670 CPWL_Color color; | 2670 CPWL_Color color; |
2671 color::ConvertArrayToPWLColor(crArray, color); | 2671 color::ConvertArrayToPWLColor(crArray, color); |
2672 | 2672 |
2673 if (m_bDelay) | 2673 if (m_bDelay) |
2674 { | 2674 { |
2675 AddDelay_Color(FP_STROKECOLOR, color); | 2675 AddDelay_Color(FP_STROKECOLOR, color); |
2676 } | 2676 } |
2677 else | 2677 else |
2678 { | 2678 { |
2679 Field::SetStrokeColor(m_pDocument, m_FieldName, m_nFormC
ontrolIndex, color); | 2679 Field::SetStrokeColor(m_pDocument, m_FieldName, m_nFormC
ontrolIndex, color); |
2680 } | 2680 } |
2681 } | 2681 } |
2682 else | 2682 else |
2683 { | 2683 { |
2684 CFX_PtrArray FieldArray; | 2684 CFX_PtrArray FieldArray; |
2685 GetFormFields(m_FieldName,FieldArray); | 2685 GetFormFields(m_FieldName,FieldArray); |
2686 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2686 » » if (FieldArray.GetSize() <= 0) return false; |
2687 | 2687 |
2688 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2688 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2689 ASSERT(pFormField != NULL); | 2689 ASSERT(pFormField != NULL); |
2690 | 2690 |
2691 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 2691 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
2692 » » if (!pFormControl)return FALSE; | 2692 » » if (!pFormControl)return false; |
2693 | 2693 |
2694 int iColorType; | 2694 int iColorType; |
2695 pFormControl->GetBorderColor(iColorType); | 2695 pFormControl->GetBorderColor(iColorType); |
2696 | 2696 |
2697 CPWL_Color color; | 2697 CPWL_Color color; |
2698 | 2698 |
2699 if (iColorType == COLORTYPE_TRANSPARENT) | 2699 if (iColorType == COLORTYPE_TRANSPARENT) |
2700 { | 2700 { |
2701 color = CPWL_Color(COLORTYPE_TRANSPARENT); | 2701 color = CPWL_Color(COLORTYPE_TRANSPARENT); |
2702 } | 2702 } |
2703 else if (iColorType == COLORTYPE_GRAY) | 2703 else if (iColorType == COLORTYPE_GRAY) |
2704 { | 2704 { |
2705 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOrig
inalBorderColor(0)); | 2705 color = CPWL_Color(COLORTYPE_GRAY, pFormControl->GetOrig
inalBorderColor(0)); |
2706 } | 2706 } |
2707 else if (iColorType == COLORTYPE_RGB) | 2707 else if (iColorType == COLORTYPE_RGB) |
2708 { | 2708 { |
2709 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOrigi
nalBorderColor(0), | 2709 color = CPWL_Color(COLORTYPE_RGB, pFormControl->GetOrigi
nalBorderColor(0), |
2710 pFormControl->GetOriginalBorderColor(1), | 2710 pFormControl->GetOriginalBorderColor(1), |
2711 pFormControl->GetOriginalBorderColor(2)); | 2711 pFormControl->GetOriginalBorderColor(2)); |
2712 } | 2712 } |
2713 else if (iColorType == COLORTYPE_CMYK) | 2713 else if (iColorType == COLORTYPE_CMYK) |
2714 { | 2714 { |
2715 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOrig
inalBorderColor(0), | 2715 color = CPWL_Color(COLORTYPE_CMYK, pFormControl->GetOrig
inalBorderColor(0), |
2716 pFormControl->GetOriginalBorderColor(1), | 2716 pFormControl->GetOriginalBorderColor(1), |
2717 pFormControl->GetOriginalBorderColor(2), | 2717 pFormControl->GetOriginalBorderColor(2), |
2718 pFormControl->GetOriginalBorderColor(3)); | 2718 pFormControl->GetOriginalBorderColor(3)); |
2719 } | 2719 } |
2720 else | 2720 else |
2721 » » » return FALSE; | 2721 » » » return false; |
2722 | 2722 |
2723 CJS_Array crArray(m_isolate); | 2723 CJS_Array crArray(m_isolate); |
2724 color::ConvertPWLColorToArray(color, crArray); | 2724 color::ConvertPWLColorToArray(color, crArray); |
2725 vp << crArray; | 2725 vp << crArray; |
2726 } | 2726 } |
2727 | 2727 |
2728 » return TRUE; | 2728 » return true; |
2729 } | 2729 } |
2730 | 2730 |
2731 void Field::SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& sw
FieldName, int nControlIndex, const CPWL_Color& color) | 2731 void Field::SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& sw
FieldName, int nControlIndex, const CPWL_Color& color) |
2732 { | 2732 { |
2733 //Not supported. | 2733 //Not supported. |
2734 } | 2734 } |
2735 | 2735 |
2736 FX_BOOL Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) | 2736 bool Field::style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
2737 { | 2737 { |
2738 ASSERT(m_pDocument != NULL); | 2738 ASSERT(m_pDocument != NULL); |
2739 | 2739 |
2740 if (vp.IsSetting()) | 2740 if (vp.IsSetting()) |
2741 { | 2741 { |
2742 » » if (!m_bCanSet) return FALSE; | 2742 » » if (!m_bCanSet) return false; |
2743 | 2743 |
2744 CFX_ByteString csBCaption; | 2744 CFX_ByteString csBCaption; |
2745 vp >> csBCaption; | 2745 vp >> csBCaption; |
2746 | 2746 |
2747 if (m_bDelay) | 2747 if (m_bDelay) |
2748 { | 2748 { |
2749 AddDelay_String(FP_STYLE, csBCaption); | 2749 AddDelay_String(FP_STYLE, csBCaption); |
2750 } | 2750 } |
2751 else | 2751 else |
2752 { | 2752 { |
2753 Field::SetStyle(m_pDocument, m_FieldName, m_nFormControl
Index, csBCaption); | 2753 Field::SetStyle(m_pDocument, m_FieldName, m_nFormControl
Index, csBCaption); |
2754 } | 2754 } |
2755 } | 2755 } |
2756 else | 2756 else |
2757 { | 2757 { |
2758 CFX_PtrArray FieldArray; | 2758 CFX_PtrArray FieldArray; |
2759 GetFormFields(m_FieldName,FieldArray); | 2759 GetFormFields(m_FieldName,FieldArray); |
2760 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2760 » » if (FieldArray.GetSize() <= 0) return false; |
2761 | 2761 |
2762 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2762 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2763 ASSERT(pFormField != NULL); | 2763 ASSERT(pFormField != NULL); |
2764 | 2764 |
2765 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && | 2765 if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON && |
2766 pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) | 2766 pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) |
2767 » » » return FALSE; | 2767 » » » return false; |
2768 | 2768 |
2769 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 2769 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
2770 » » if (!pFormControl) return FALSE; | 2770 » » if (!pFormControl) return false; |
2771 | 2771 |
2772 CFX_WideString csWCaption = pFormControl->GetNormalCaption(); | 2772 CFX_WideString csWCaption = pFormControl->GetNormalCaption(); |
2773 CFX_ByteString csBCaption; | 2773 CFX_ByteString csBCaption; |
2774 | 2774 |
2775 switch (csWCaption[0]) | 2775 switch (csWCaption[0]) |
2776 { | 2776 { |
2777 case L'l': | 2777 case L'l': |
2778 csBCaption = "circle"; | 2778 csBCaption = "circle"; |
2779 break; | 2779 break; |
2780 case L'8': | 2780 case L'8': |
2781 csBCaption = "cross"; | 2781 csBCaption = "cross"; |
2782 break; | 2782 break; |
2783 case L'u': | 2783 case L'u': |
2784 csBCaption = "diamond"; | 2784 csBCaption = "diamond"; |
2785 break; | 2785 break; |
2786 case L'n': | 2786 case L'n': |
2787 csBCaption = "square"; | 2787 csBCaption = "square"; |
2788 break; | 2788 break; |
2789 case L'H': | 2789 case L'H': |
2790 csBCaption = "star"; | 2790 csBCaption = "star"; |
2791 break; | 2791 break; |
2792 default: //L'4' | 2792 default: //L'4' |
2793 csBCaption = "check"; | 2793 csBCaption = "check"; |
2794 break; | 2794 break; |
2795 } | 2795 } |
2796 vp << csBCaption; | 2796 vp << csBCaption; |
2797 } | 2797 } |
2798 | 2798 |
2799 » return TRUE; | 2799 » return true; |
2800 } | 2800 } |
2801 | 2801 |
2802 void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN
ame, int nControlIndex, | 2802 void Field::SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN
ame, int nControlIndex, |
2803 const CFX_ByteString& string) | 2803 const CFX_ByteString& string) |
2804 { | 2804 { |
2805 //Not supported. | 2805 //Not supported. |
2806 } | 2806 } |
2807 | 2807 |
2808 FX_BOOL Field::submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) | 2808 bool Field::submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
2809 { | 2809 { |
2810 » return TRUE; | 2810 » return true; |
2811 } | 2811 } |
2812 | 2812 |
2813 FX_BOOL Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) | 2813 bool Field::textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) |
2814 { | 2814 { |
2815 ASSERT(m_pDocument != NULL); | 2815 ASSERT(m_pDocument != NULL); |
2816 | 2816 |
2817 if (vp.IsSetting()) | 2817 if (vp.IsSetting()) |
2818 { | 2818 { |
2819 » » if (!m_bCanSet) return FALSE; | 2819 » » if (!m_bCanSet) return false; |
2820 | 2820 |
2821 CJS_Array crArray(m_isolate); | 2821 CJS_Array crArray(m_isolate); |
2822 » » if (!vp.IsArrayObject())return FALSE; | 2822 » » if (!vp.IsArrayObject())return false; |
2823 vp >> crArray; | 2823 vp >> crArray; |
2824 | 2824 |
2825 CPWL_Color color; | 2825 CPWL_Color color; |
2826 color::ConvertArrayToPWLColor(crArray, color); | 2826 color::ConvertArrayToPWLColor(crArray, color); |
2827 | 2827 |
2828 if (m_bDelay) | 2828 if (m_bDelay) |
2829 { | 2829 { |
2830 AddDelay_Color(FP_TEXTCOLOR, color); | 2830 AddDelay_Color(FP_TEXTCOLOR, color); |
2831 } | 2831 } |
2832 else | 2832 else |
2833 { | 2833 { |
2834 Field::SetTextColor(m_pDocument, m_FieldName, m_nFormCon
trolIndex, color); | 2834 Field::SetTextColor(m_pDocument, m_FieldName, m_nFormCon
trolIndex, color); |
2835 } | 2835 } |
2836 } | 2836 } |
2837 else | 2837 else |
2838 { | 2838 { |
2839 CFX_PtrArray FieldArray; | 2839 CFX_PtrArray FieldArray; |
2840 GetFormFields(m_FieldName,FieldArray); | 2840 GetFormFields(m_FieldName,FieldArray); |
2841 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2841 » » if (FieldArray.GetSize() <= 0) return false; |
2842 | 2842 |
2843 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2843 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2844 ASSERT(pFormField != NULL); | 2844 ASSERT(pFormField != NULL); |
2845 | 2845 |
2846 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 2846 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
2847 » » if (!pFormControl)return FALSE; | 2847 » » if (!pFormControl)return false; |
2848 | 2848 |
2849 int iColorType; | 2849 int iColorType; |
2850 FX_ARGB color; | 2850 FX_ARGB color; |
2851 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaul
tAppearance(); | 2851 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaul
tAppearance(); |
2852 FieldAppearance.GetColor(color, iColorType); | 2852 FieldAppearance.GetColor(color, iColorType); |
2853 int32_t a,r,g,b; | 2853 int32_t a,r,g,b; |
2854 ArgbDecode(color, a, r, g, b); | 2854 ArgbDecode(color, a, r, g, b); |
2855 | 2855 |
2856 CPWL_Color crRet = CPWL_Color(COLORTYPE_RGB, r / 255.0f, | 2856 CPWL_Color crRet = CPWL_Color(COLORTYPE_RGB, r / 255.0f, |
2857 g / 255.0f, | 2857 g / 255.0f, |
2858 b / 255.0f); | 2858 b / 255.0f); |
2859 | 2859 |
2860 if (iColorType == COLORTYPE_TRANSPARENT) | 2860 if (iColorType == COLORTYPE_TRANSPARENT) |
2861 crRet = CPWL_Color(COLORTYPE_TRANSPARENT); | 2861 crRet = CPWL_Color(COLORTYPE_TRANSPARENT); |
2862 | 2862 |
2863 CJS_Array crArray(m_isolate); | 2863 CJS_Array crArray(m_isolate); |
2864 color::ConvertPWLColorToArray(crRet, crArray); | 2864 color::ConvertPWLColorToArray(crRet, crArray); |
2865 vp << crArray; | 2865 vp << crArray; |
2866 } | 2866 } |
2867 | 2867 |
2868 » return TRUE; | 2868 » return true; |
2869 } | 2869 } |
2870 | 2870 |
2871 void Field::SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, const CPWL_Color& color) | 2871 void Field::SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFi
eldName, int nControlIndex, const CPWL_Color& color) |
2872 { | 2872 { |
2873 //Not supported. | 2873 //Not supported. |
2874 } | 2874 } |
2875 | 2875 |
2876 FX_BOOL Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2876 bool Field::textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2877 { | 2877 { |
2878 ASSERT(m_pDocument != NULL); | 2878 ASSERT(m_pDocument != NULL); |
2879 | 2879 |
2880 if (vp.IsSetting()) | 2880 if (vp.IsSetting()) |
2881 { | 2881 { |
2882 » » if (!m_bCanSet) return FALSE; | 2882 » » if (!m_bCanSet) return false; |
2883 | 2883 |
2884 CFX_ByteString csFontName; | 2884 CFX_ByteString csFontName; |
2885 vp >> csFontName; | 2885 vp >> csFontName; |
2886 » » if (csFontName.IsEmpty()) return FALSE; | 2886 » » if (csFontName.IsEmpty()) return false; |
2887 | 2887 |
2888 if (m_bDelay) | 2888 if (m_bDelay) |
2889 { | 2889 { |
2890 AddDelay_String(FP_TEXTFONT, csFontName); | 2890 AddDelay_String(FP_TEXTFONT, csFontName); |
2891 } | 2891 } |
2892 else | 2892 else |
2893 { | 2893 { |
2894 Field::SetTextFont(m_pDocument, m_FieldName, m_nFormCont
rolIndex, csFontName); | 2894 Field::SetTextFont(m_pDocument, m_FieldName, m_nFormCont
rolIndex, csFontName); |
2895 } | 2895 } |
2896 } | 2896 } |
2897 else | 2897 else |
2898 { | 2898 { |
2899 CFX_PtrArray FieldArray; | 2899 CFX_PtrArray FieldArray; |
2900 GetFormFields(m_FieldName,FieldArray); | 2900 GetFormFields(m_FieldName,FieldArray); |
2901 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2901 » » if (FieldArray.GetSize() <= 0) return false; |
2902 | 2902 |
2903 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2903 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2904 ASSERT(pFormField != NULL); | 2904 ASSERT(pFormField != NULL); |
2905 | 2905 |
2906 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 2906 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
2907 » » if (!pFormControl)return FALSE; | 2907 » » if (!pFormControl)return false; |
2908 | 2908 |
2909 int nFieldType = pFormField->GetFieldType(); | 2909 int nFieldType = pFormField->GetFieldType(); |
2910 | 2910 |
2911 if (nFieldType == FIELDTYPE_PUSHBUTTON || | 2911 if (nFieldType == FIELDTYPE_PUSHBUTTON || |
2912 nFieldType == FIELDTYPE_COMBOBOX || | 2912 nFieldType == FIELDTYPE_COMBOBOX || |
2913 nFieldType == FIELDTYPE_LISTBOX || | 2913 nFieldType == FIELDTYPE_LISTBOX || |
2914 nFieldType == FIELDTYPE_TEXTFIELD) | 2914 nFieldType == FIELDTYPE_TEXTFIELD) |
2915 { | 2915 { |
2916 CPDF_Font * pFont = pFormControl->GetDefaultControlFont(
); | 2916 CPDF_Font * pFont = pFormControl->GetDefaultControlFont(
); |
2917 » » » if (!pFont) return FALSE; | 2917 » » » if (!pFont) return false; |
2918 | 2918 |
2919 vp << pFont->GetBaseFont(); | 2919 vp << pFont->GetBaseFont(); |
2920 } | 2920 } |
2921 else | 2921 else |
2922 » » » return FALSE; | 2922 » » » return false; |
2923 } | 2923 } |
2924 | 2924 |
2925 » return TRUE; | 2925 » return true; |
2926 } | 2926 } |
2927 | 2927 |
2928 void Field::SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, const CFX_ByteString& string) | 2928 void Field::SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, const CFX_ByteString& string) |
2929 { | 2929 { |
2930 //Not supported. | 2930 //Not supported. |
2931 } | 2931 } |
2932 | 2932 |
2933 FX_BOOL Field::textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 2933 bool Field::textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
2934 { | 2934 { |
2935 ASSERT(m_pDocument != NULL); | 2935 ASSERT(m_pDocument != NULL); |
2936 | 2936 |
2937 if (vp.IsSetting()) | 2937 if (vp.IsSetting()) |
2938 { | 2938 { |
2939 » » if (!m_bCanSet) return FALSE; | 2939 » » if (!m_bCanSet) return false; |
2940 | 2940 |
2941 int nVP; | 2941 int nVP; |
2942 vp >> nVP; | 2942 vp >> nVP; |
2943 | 2943 |
2944 if (m_bDelay) | 2944 if (m_bDelay) |
2945 { | 2945 { |
2946 AddDelay_Int(FP_TEXTSIZE, nVP); | 2946 AddDelay_Int(FP_TEXTSIZE, nVP); |
2947 } | 2947 } |
2948 else | 2948 else |
2949 { | 2949 { |
2950 Field::SetTextSize(m_pDocument, m_FieldName, m_nFormCont
rolIndex, nVP); | 2950 Field::SetTextSize(m_pDocument, m_FieldName, m_nFormCont
rolIndex, nVP); |
2951 } | 2951 } |
2952 } | 2952 } |
2953 else | 2953 else |
2954 { | 2954 { |
2955 CFX_PtrArray FieldArray; | 2955 CFX_PtrArray FieldArray; |
2956 GetFormFields(m_FieldName,FieldArray); | 2956 GetFormFields(m_FieldName,FieldArray); |
2957 » » if (FieldArray.GetSize() <= 0) return FALSE; | 2957 » » if (FieldArray.GetSize() <= 0) return false; |
2958 | 2958 |
2959 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 2959 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
2960 ASSERT(pFormField != NULL); | 2960 ASSERT(pFormField != NULL); |
2961 | 2961 |
2962 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); | 2962 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField
); |
2963 » » if (!pFormControl)return FALSE; | 2963 » » if (!pFormControl)return false; |
2964 | 2964 |
2965 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaul
tAppearance(); | 2965 CPDF_DefaultAppearance FieldAppearance = pFormControl->GetDefaul
tAppearance(); |
2966 | 2966 |
2967 CFX_ByteString csFontNameTag; | 2967 CFX_ByteString csFontNameTag; |
2968 FX_FLOAT fFontSize; | 2968 FX_FLOAT fFontSize; |
2969 FieldAppearance.GetFont(csFontNameTag,fFontSize); | 2969 FieldAppearance.GetFont(csFontNameTag,fFontSize); |
2970 | 2970 |
2971 vp << (int)fFontSize; | 2971 vp << (int)fFontSize; |
2972 } | 2972 } |
2973 | 2973 |
2974 » return TRUE; | 2974 » return true; |
2975 } | 2975 } |
2976 | 2976 |
2977 void Field::SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, int number) | 2977 void Field::SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, int number) |
2978 { | 2978 { |
2979 //Not supported. | 2979 //Not supported. |
2980 } | 2980 } |
2981 | 2981 |
2982 FX_BOOL Field::type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError
) | 2982 bool Field::type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
2983 { | 2983 { |
2984 ASSERT(m_pDocument != NULL); | 2984 ASSERT(m_pDocument != NULL); |
2985 | 2985 |
2986 » if (!vp.IsGetting()) return FALSE; | 2986 » if (!vp.IsGetting()) return false; |
2987 | 2987 |
2988 CFX_PtrArray FieldArray; | 2988 CFX_PtrArray FieldArray; |
2989 GetFormFields(m_FieldName,FieldArray); | 2989 GetFormFields(m_FieldName,FieldArray); |
2990 » if (FieldArray.GetSize() <= 0) return FALSE; | 2990 » if (FieldArray.GetSize() <= 0) return false; |
2991 | 2991 |
2992 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 2992 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
2993 ASSERT(pFormField != NULL); | 2993 ASSERT(pFormField != NULL); |
2994 | 2994 |
2995 switch (pFormField->GetFieldType()) | 2995 switch (pFormField->GetFieldType()) |
2996 { | 2996 { |
2997 case FIELDTYPE_UNKNOWN: | 2997 case FIELDTYPE_UNKNOWN: |
2998 vp << L"unknown"; | 2998 vp << L"unknown"; |
2999 break; | 2999 break; |
3000 case FIELDTYPE_PUSHBUTTON: | 3000 case FIELDTYPE_PUSHBUTTON: |
(...skipping 15 matching lines...) Expand all Loading... |
3016 vp << L"text"; | 3016 vp << L"text"; |
3017 break; | 3017 break; |
3018 case FIELDTYPE_SIGNATURE: | 3018 case FIELDTYPE_SIGNATURE: |
3019 vp << L"signature"; | 3019 vp << L"signature"; |
3020 break; | 3020 break; |
3021 default : | 3021 default : |
3022 vp << L"unknown"; | 3022 vp << L"unknown"; |
3023 break; | 3023 break; |
3024 } | 3024 } |
3025 | 3025 |
3026 » return TRUE; | 3026 » return true; |
3027 } | 3027 } |
3028 | 3028 |
3029 FX_BOOL Field::userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) | 3029 bool Field::userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) |
3030 { | 3030 { |
3031 ASSERT(m_pDocument != NULL); | 3031 ASSERT(m_pDocument != NULL); |
3032 | 3032 |
3033 if (vp.IsSetting()) | 3033 if (vp.IsSetting()) |
3034 { | 3034 { |
3035 » » if (!m_bCanSet) return FALSE; | 3035 » » if (!m_bCanSet) return false; |
3036 | 3036 |
3037 CFX_WideString swName; | 3037 CFX_WideString swName; |
3038 vp >> swName; | 3038 vp >> swName; |
3039 | 3039 |
3040 if (m_bDelay) | 3040 if (m_bDelay) |
3041 { | 3041 { |
3042 AddDelay_WideString(FP_USERNAME, swName); | 3042 AddDelay_WideString(FP_USERNAME, swName); |
3043 } | 3043 } |
3044 else | 3044 else |
3045 { | 3045 { |
3046 Field::SetUserName(m_pDocument, m_FieldName, m_nFormCont
rolIndex, swName); | 3046 Field::SetUserName(m_pDocument, m_FieldName, m_nFormCont
rolIndex, swName); |
3047 } | 3047 } |
3048 } | 3048 } |
3049 else | 3049 else |
3050 { | 3050 { |
3051 CFX_PtrArray FieldArray; | 3051 CFX_PtrArray FieldArray; |
3052 GetFormFields(m_FieldName,FieldArray); | 3052 GetFormFields(m_FieldName,FieldArray); |
3053 » » if (FieldArray.GetSize() <= 0) return FALSE; | 3053 » » if (FieldArray.GetSize() <= 0) return false; |
3054 | 3054 |
3055 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 3055 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
3056 ASSERT(pFormField != NULL); | 3056 ASSERT(pFormField != NULL); |
3057 | 3057 |
3058 vp << (CFX_WideString)pFormField->GetAlternateName(); | 3058 vp << (CFX_WideString)pFormField->GetAlternateName(); |
3059 } | 3059 } |
3060 | 3060 |
3061 » return TRUE; | 3061 » return true; |
3062 } | 3062 } |
3063 | 3063 |
3064 void Field::SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, const CFX_WideString& string) | 3064 void Field::SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFie
ldName, int nControlIndex, const CFX_WideString& string) |
3065 { | 3065 { |
3066 //Not supported. | 3066 //Not supported. |
3067 } | 3067 } |
3068 | 3068 |
3069 FX_BOOL Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r) | 3069 bool Field::value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
3070 { | 3070 { |
3071 ASSERT(m_pDocument != NULL); | 3071 ASSERT(m_pDocument != NULL); |
3072 | 3072 |
3073 if (vp.IsSetting()) | 3073 if (vp.IsSetting()) |
3074 { | 3074 { |
3075 » » if (!m_bCanSet) return FALSE; | 3075 » » if (!m_bCanSet) return false; |
3076 | 3076 |
3077 CJS_WideStringArray strArray; | 3077 CJS_WideStringArray strArray; |
3078 | 3078 |
3079 if (vp.IsArrayObject()) | 3079 if (vp.IsArrayObject()) |
3080 { | 3080 { |
3081 CJS_Array ValueArray(m_isolate); | 3081 CJS_Array ValueArray(m_isolate); |
3082 vp.ConvertToArray(ValueArray); | 3082 vp.ConvertToArray(ValueArray); |
3083 for (int i = 0,sz = ValueArray.GetLength(); i < sz; i++) | 3083 for (int i = 0,sz = ValueArray.GetLength(); i < sz; i++) |
3084 { | 3084 { |
3085 CJS_Value ElementValue(m_isolate); | 3085 CJS_Value ElementValue(m_isolate); |
(...skipping 15 matching lines...) Expand all Loading... |
3101 } | 3101 } |
3102 else | 3102 else |
3103 { | 3103 { |
3104 Field::SetValue(m_pDocument, m_FieldName, m_nFormControl
Index, strArray); | 3104 Field::SetValue(m_pDocument, m_FieldName, m_nFormControl
Index, strArray); |
3105 } | 3105 } |
3106 } | 3106 } |
3107 else | 3107 else |
3108 { | 3108 { |
3109 CFX_PtrArray FieldArray; | 3109 CFX_PtrArray FieldArray; |
3110 GetFormFields(m_FieldName,FieldArray); | 3110 GetFormFields(m_FieldName,FieldArray); |
3111 » » if (FieldArray.GetSize() <= 0) return FALSE; | 3111 » » if (FieldArray.GetSize() <= 0) return false; |
3112 | 3112 |
3113 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); | 3113 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(0); |
3114 ASSERT(pFormField != NULL); | 3114 ASSERT(pFormField != NULL); |
3115 | 3115 |
3116 | 3116 |
3117 | 3117 |
3118 switch (pFormField->GetFieldType()) | 3118 switch (pFormField->GetFieldType()) |
3119 { | 3119 { |
3120 case FIELDTYPE_PUSHBUTTON: | 3120 case FIELDTYPE_PUSHBUTTON: |
3121 » » » return FALSE; | 3121 » » » return false; |
3122 case FIELDTYPE_COMBOBOX: | 3122 case FIELDTYPE_COMBOBOX: |
3123 case FIELDTYPE_TEXTFIELD: | 3123 case FIELDTYPE_TEXTFIELD: |
3124 { | 3124 { |
3125 CFX_WideString swValue = pFormField->GetValue(); | 3125 CFX_WideString swValue = pFormField->GetValue(); |
3126 | 3126 |
3127 double dRet; | 3127 double dRet; |
3128 » » » » FX_BOOL bDot; | 3128 » » » » bool bDot; |
3129 if (CJS_PublicMethods::ConvertStringToNumber(swV
alue.c_str(), dRet, bDot)) | 3129 if (CJS_PublicMethods::ConvertStringToNumber(swV
alue.c_str(), dRet, bDot)) |
3130 { | 3130 { |
3131 if (bDot) | 3131 if (bDot) |
3132 vp << dRet; | 3132 vp << dRet; |
3133 else | 3133 else |
3134 vp << dRet; | 3134 vp << dRet; |
3135 } | 3135 } |
3136 else | 3136 else |
3137 vp << swValue; | 3137 vp << swValue; |
3138 } | 3138 } |
(...skipping 13 matching lines...) Expand all Loading... |
3152 ElementValue = pFormFiel
d->GetOptionLabel(iIndex).c_str(); | 3152 ElementValue = pFormFiel
d->GetOptionLabel(iIndex).c_str(); |
3153 ValueArray.SetElement(i, Element
Value); | 3153 ValueArray.SetElement(i, Element
Value); |
3154 } | 3154 } |
3155 vp << ValueArray; | 3155 vp << ValueArray; |
3156 } | 3156 } |
3157 else | 3157 else |
3158 { | 3158 { |
3159 CFX_WideString swValue = pFormField->Get
Value(); | 3159 CFX_WideString swValue = pFormField->Get
Value(); |
3160 | 3160 |
3161 double dRet; | 3161 double dRet; |
3162 » » » » » FX_BOOL bDot; | 3162 » » » » » bool bDot; |
3163 if (CJS_PublicMethods::ConvertStringToNu
mber(swValue.c_str(), dRet, bDot)) | 3163 if (CJS_PublicMethods::ConvertStringToNu
mber(swValue.c_str(), dRet, bDot)) |
3164 { | 3164 { |
3165 if (bDot) | 3165 if (bDot) |
3166 vp << dRet; | 3166 vp << dRet; |
3167 else | 3167 else |
3168 vp << dRet; | 3168 vp << dRet; |
3169 } | 3169 } |
3170 else | 3170 else |
3171 vp << swValue; | 3171 vp << swValue; |
3172 } | 3172 } |
3173 } | 3173 } |
3174 break; | 3174 break; |
3175 case FIELDTYPE_CHECKBOX: | 3175 case FIELDTYPE_CHECKBOX: |
3176 case FIELDTYPE_RADIOBUTTON: | 3176 case FIELDTYPE_RADIOBUTTON: |
3177 { | 3177 { |
3178 » » » » FX_BOOL bFind = FALSE; | 3178 » » » » bool bFind = false; |
3179 for (int i = 0 , sz = pFormField->CountControls(
); i < sz; i++) | 3179 for (int i = 0 , sz = pFormField->CountControls(
); i < sz; i++) |
3180 { | 3180 { |
3181 if (pFormField->GetControl(i)->IsChecked
()) | 3181 if (pFormField->GetControl(i)->IsChecked
()) |
3182 { | 3182 { |
3183 CFX_WideString swValue = pFormFi
eld->GetControl(i)->GetExportValue(); | 3183 CFX_WideString swValue = pFormFi
eld->GetControl(i)->GetExportValue(); |
3184 double dRet; | 3184 double dRet; |
3185 » » » » » » FX_BOOL bDot; | 3185 » » » » » » bool bDot; |
3186 if (CJS_PublicMethods::ConvertSt
ringToNumber(swValue.c_str(), dRet, bDot)) | 3186 if (CJS_PublicMethods::ConvertSt
ringToNumber(swValue.c_str(), dRet, bDot)) |
3187 { | 3187 { |
3188 if (bDot) | 3188 if (bDot) |
3189 vp << dRet; | 3189 vp << dRet; |
3190 else | 3190 else |
3191 vp << dRet; | 3191 vp << dRet; |
3192 } | 3192 } |
3193 else | 3193 else |
3194 vp << swValue; | 3194 vp << swValue; |
3195 | 3195 |
3196 » » » » » » bFind = TRUE; | 3196 » » » » » » bFind = true; |
3197 break; | 3197 break; |
3198 } | 3198 } |
3199 else | 3199 else |
3200 continue; | 3200 continue; |
3201 } | 3201 } |
3202 if (!bFind) | 3202 if (!bFind) |
3203 vp << L"Off"; | 3203 vp << L"Off"; |
3204 } | 3204 } |
3205 break; | 3205 break; |
3206 default: | 3206 default: |
3207 vp << pFormField->GetValue(); | 3207 vp << pFormField->GetValue(); |
3208 break; | 3208 break; |
3209 } | 3209 } |
3210 } | 3210 } |
3211 | 3211 |
3212 » return TRUE; | 3212 » return true; |
3213 } | 3213 } |
3214 | 3214 |
3215 void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN
ame, | 3215 void Field::SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldN
ame, |
3216 int nControlIndex, const CJS_WideString
Array& strArray) | 3216 int nControlIndex, const CJS_WideString
Array& strArray) |
3217 { | 3217 { |
3218 ASSERT(pDocument != NULL); | 3218 ASSERT(pDocument != NULL); |
3219 | 3219 |
3220 if (strArray.GetSize() < 1) return; | 3220 if (strArray.GetSize() < 1) return; |
3221 | 3221 |
3222 CFX_PtrArray FieldArray; | 3222 CFX_PtrArray FieldArray; |
3223 GetFormFields(pDocument, swFieldName, FieldArray); | 3223 GetFormFields(pDocument, swFieldName, FieldArray); |
3224 | 3224 |
3225 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) | 3225 for (int i=0,isz=FieldArray.GetSize(); i<isz; i++) |
3226 { | 3226 { |
3227 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 3227 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
3228 ASSERT(pFormField != NULL); | 3228 ASSERT(pFormField != NULL); |
3229 | 3229 |
3230 if (pFormField->GetFullName().Compare(swFieldName) != 0) | 3230 if (pFormField->GetFullName().Compare(swFieldName) != 0) |
3231 continue; | 3231 continue; |
3232 | 3232 |
3233 switch (pFormField->GetFieldType()) | 3233 switch (pFormField->GetFieldType()) |
3234 { | 3234 { |
3235 case FIELDTYPE_TEXTFIELD: | 3235 case FIELDTYPE_TEXTFIELD: |
3236 case FIELDTYPE_COMBOBOX: | 3236 case FIELDTYPE_COMBOBOX: |
3237 if (pFormField->GetValue() != strArray.GetAt(0)) | 3237 if (pFormField->GetValue() != strArray.GetAt(0)) |
3238 { | 3238 { |
3239 CFX_WideString WideString = strArray.GetAt(0); | 3239 CFX_WideString WideString = strArray.GetAt(0); |
3240 » » » » pFormField->SetValue(strArray.GetAt(0), TRUE); | 3240 » » » » pFormField->SetValue(strArray.GetAt(0), true); |
3241 » » » » UpdateFormField(pDocument, pFormField, TRUE, FAL
SE, TRUE); | 3241 » » » » UpdateFormField(pDocument, pFormField, true, fal
se, true); |
3242 } | 3242 } |
3243 break; | 3243 break; |
3244 case FIELDTYPE_CHECKBOX: //mantis: 0004493 | 3244 case FIELDTYPE_CHECKBOX: //mantis: 0004493 |
3245 case FIELDTYPE_RADIOBUTTON: | 3245 case FIELDTYPE_RADIOBUTTON: |
3246 { | 3246 { |
3247 if (pFormField->GetValue() != strArray.GetAt(0)) | 3247 if (pFormField->GetValue() != strArray.GetAt(0)) |
3248 { | 3248 { |
3249 » » » » » pFormField->SetValue(strArray.GetAt(0),
TRUE); | 3249 » » » » » pFormField->SetValue(strArray.GetAt(0),
true); |
3250 » » » » » UpdateFormField(pDocument, pFormField, T
RUE, FALSE, TRUE); | 3250 » » » » » UpdateFormField(pDocument, pFormField, t
rue, false, true); |
3251 } | 3251 } |
3252 } | 3252 } |
3253 break; | 3253 break; |
3254 case FIELDTYPE_LISTBOX: | 3254 case FIELDTYPE_LISTBOX: |
3255 { | 3255 { |
3256 » » » » FX_BOOL bModified = FALSE; | 3256 » » » » bool bModified = false; |
3257 | 3257 |
3258 for (int i=0,sz=strArray.GetSize(); i<sz; i++) | 3258 for (int i=0,sz=strArray.GetSize(); i<sz; i++) |
3259 { | 3259 { |
3260 int iIndex = pFormField->FindOption(strA
rray.GetAt(i)); | 3260 int iIndex = pFormField->FindOption(strA
rray.GetAt(i)); |
3261 | 3261 |
3262 if (!pFormField->IsItemSelected(iIndex)) | 3262 if (!pFormField->IsItemSelected(iIndex)) |
3263 { | 3263 { |
3264 » » » » » » bModified = TRUE; | 3264 » » » » » » bModified = true; |
3265 break; | 3265 break; |
3266 } | 3266 } |
3267 } | 3267 } |
3268 | 3268 |
3269 if (bModified) | 3269 if (bModified) |
3270 { | 3270 { |
3271 » » » » » pFormField->ClearSelection(TRUE); | 3271 » » » » » pFormField->ClearSelection(true); |
3272 for (int i=0,sz=strArray.GetSize(); i<sz
; i++) | 3272 for (int i=0,sz=strArray.GetSize(); i<sz
; i++) |
3273 { | 3273 { |
3274 int iIndex = pFormField->FindOpt
ion(strArray.GetAt(i)); | 3274 int iIndex = pFormField->FindOpt
ion(strArray.GetAt(i)); |
3275 » » » » » » pFormField->SetItemSelection(iIn
dex, TRUE, TRUE); | 3275 » » » » » » pFormField->SetItemSelection(iIn
dex, true, true); |
3276 } | 3276 } |
3277 | 3277 |
3278 » » » » » UpdateFormField(pDocument, pFormField, T
RUE, FALSE, TRUE); | 3278 » » » » » UpdateFormField(pDocument, pFormField, t
rue, false, true); |
3279 } | 3279 } |
3280 } | 3280 } |
3281 break; | 3281 break; |
3282 default: | 3282 default: |
3283 break; | 3283 break; |
3284 } | 3284 } |
3285 } | 3285 } |
3286 } | 3286 } |
3287 | 3287 |
3288 FX_BOOL Field::valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStrin
g& sError) | 3288 bool Field::valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
3289 { | 3289 { |
3290 ASSERT(m_pDocument != NULL); | 3290 ASSERT(m_pDocument != NULL); |
3291 | 3291 |
3292 » if (!vp.IsGetting()) return FALSE; | 3292 » if (!vp.IsGetting()) return false; |
3293 | 3293 |
3294 CFX_PtrArray FieldArray; | 3294 CFX_PtrArray FieldArray; |
3295 GetFormFields(m_FieldName,FieldArray); | 3295 GetFormFields(m_FieldName,FieldArray); |
3296 » if (FieldArray.GetSize() <= 0) return FALSE; | 3296 » if (FieldArray.GetSize() <= 0) return false; |
3297 | 3297 |
3298 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3298 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3299 ASSERT(pFormField != NULL); | 3299 ASSERT(pFormField != NULL); |
3300 | 3300 |
3301 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 3301 if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
3302 » » return FALSE; | 3302 » » return false; |
3303 | 3303 |
3304 if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) | 3304 if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) |
3305 { | 3305 { |
3306 » » if(!pFormField->CountControls()) return FALSE; | 3306 » » if(!pFormField->CountControls()) return false; |
3307 | 3307 |
3308 if (pFormField->GetControl(0)->IsChecked()) | 3308 if (pFormField->GetControl(0)->IsChecked()) |
3309 vp << L"Yes"; | 3309 vp << L"Yes"; |
3310 else | 3310 else |
3311 vp << L"Off"; | 3311 vp << L"Off"; |
3312 } | 3312 } |
3313 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormF
ield->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)) | 3313 else if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON && !(pFormF
ield->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)) |
3314 { | 3314 { |
3315 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) | 3315 for (int i=0, sz=pFormField->CountControls(); i<sz; i++) |
3316 { | 3316 { |
3317 if (pFormField->GetControl(i)->IsChecked()) | 3317 if (pFormField->GetControl(i)->IsChecked()) |
3318 { | 3318 { |
3319 vp << pFormField->GetControl(i)->GetExportValue(
).c_str(); | 3319 vp << pFormField->GetControl(i)->GetExportValue(
).c_str(); |
3320 break; | 3320 break; |
3321 } | 3321 } |
3322 else | 3322 else |
3323 vp << L"Off"; | 3323 vp << L"Off"; |
3324 } | 3324 } |
3325 } | 3325 } |
3326 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField-
>CountSelectedItems() > 1)) | 3326 else if (pFormField->GetFieldType() == FIELDTYPE_LISTBOX && (pFormField-
>CountSelectedItems() > 1)) |
3327 { | 3327 { |
3328 vp << L""; | 3328 vp << L""; |
3329 } | 3329 } |
3330 else | 3330 else |
3331 vp << pFormField->GetValue().c_str(); | 3331 vp << pFormField->GetValue().c_str(); |
3332 | 3332 |
3333 » return TRUE; | 3333 » return true; |
3334 } | 3334 } |
3335 | 3335 |
3336 /* --------------------------------- methods --------------------------------- *
/ | 3336 /* --------------------------------- methods --------------------------------- *
/ |
3337 | 3337 |
3338 FX_BOOL Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError) | 3338 bool Field::browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, CFX_WideString& sError) |
3339 { | 3339 { |
3340 ASSERT(m_pDocument != NULL); | 3340 ASSERT(m_pDocument != NULL); |
3341 | 3341 |
3342 CFX_PtrArray FieldArray; | 3342 CFX_PtrArray FieldArray; |
3343 GetFormFields(m_FieldName, FieldArray); | 3343 GetFormFields(m_FieldName, FieldArray); |
3344 » if (FieldArray.GetSize() <= 0) return FALSE; | 3344 » if (FieldArray.GetSize() <= 0) return false; |
3345 | 3345 |
3346 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3346 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3347 ASSERT(pFormField != NULL); | 3347 ASSERT(pFormField != NULL); |
3348 | 3348 |
3349 CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); | 3349 CPDFDoc_Environment* pApp = m_pDocument->GetEnv(); |
3350 ASSERT(pApp != NULL); | 3350 ASSERT(pApp != NULL); |
3351 | 3351 |
3352 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && | 3352 if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && |
3353 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) | 3353 (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) |
3354 { | 3354 { |
3355 CFX_WideString wsFileName = pApp->JS_fieldBrowse(); | 3355 CFX_WideString wsFileName = pApp->JS_fieldBrowse(); |
3356 if(!wsFileName.IsEmpty()) | 3356 if(!wsFileName.IsEmpty()) |
3357 { | 3357 { |
3358 pFormField->SetValue(wsFileName); | 3358 pFormField->SetValue(wsFileName); |
3359 » » » UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRU
E); | 3359 » » » UpdateFormField(m_pDocument, pFormField, true, true, tru
e); |
3360 } | 3360 } |
3361 } | 3361 } |
3362 else | 3362 else |
3363 » » return FALSE; | 3363 » » return false; |
3364 | 3364 |
3365 » return TRUE; | 3365 » return true; |
3366 } | 3366 } |
3367 | 3367 |
3368 | 3368 |
3369 FX_BOOL Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) | 3369 bool Field::buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
3370 { | 3370 { |
3371 ASSERT(m_pDocument != NULL); | 3371 ASSERT(m_pDocument != NULL); |
3372 | 3372 |
3373 int nface = 0; | 3373 int nface = 0; |
3374 int iSize = params.size(); | 3374 int iSize = params.size(); |
3375 if (iSize >= 1) | 3375 if (iSize >= 1) |
3376 nface = params[0].ToInt(); | 3376 nface = params[0].ToInt(); |
3377 | 3377 |
3378 CFX_PtrArray FieldArray; | 3378 CFX_PtrArray FieldArray; |
3379 GetFormFields(m_FieldName,FieldArray); | 3379 GetFormFields(m_FieldName,FieldArray); |
3380 » if (FieldArray.GetSize() <= 0) return FALSE; | 3380 » if (FieldArray.GetSize() <= 0) return false; |
3381 | 3381 |
3382 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3382 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3383 ASSERT(pFormField != NULL); | 3383 ASSERT(pFormField != NULL); |
3384 | 3384 |
3385 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 3385 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
3386 » » return FALSE; | 3386 » » return false; |
3387 | 3387 |
3388 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); | 3388 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); |
3389 » if (!pFormControl)return FALSE; | 3389 » if (!pFormControl)return false; |
3390 | 3390 |
3391 if (nface == 0) | 3391 if (nface == 0) |
3392 vRet = pFormControl->GetNormalCaption().c_str(); | 3392 vRet = pFormControl->GetNormalCaption().c_str(); |
3393 else if (nface == 1) | 3393 else if (nface == 1) |
3394 vRet = pFormControl->GetDownCaption().c_str(); | 3394 vRet = pFormControl->GetDownCaption().c_str(); |
3395 else if (nface == 2) | 3395 else if (nface == 2) |
3396 vRet = pFormControl->GetRolloverCaption().c_str(); | 3396 vRet = pFormControl->GetRolloverCaption().c_str(); |
3397 else | 3397 else |
3398 » » return FALSE; | 3398 » » return false; |
3399 | 3399 |
3400 » return TRUE; | 3400 » return true; |
3401 } | 3401 } |
3402 | 3402 |
3403 //#pragma warning(disable: 4800) | 3403 //#pragma warning(disable: 4800) |
3404 | 3404 |
3405 FX_BOOL Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) | 3405 bool Field::buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
3406 { | 3406 { |
3407 ASSERT(m_pDocument != NULL); | 3407 ASSERT(m_pDocument != NULL); |
3408 | 3408 |
3409 int nface = 0; | 3409 int nface = 0; |
3410 int iSize = params.size(); | 3410 int iSize = params.size(); |
3411 if (iSize >= 1) | 3411 if (iSize >= 1) |
3412 nface = params[0].ToInt(); | 3412 nface = params[0].ToInt(); |
3413 | 3413 |
3414 CFX_PtrArray FieldArray; | 3414 CFX_PtrArray FieldArray; |
3415 GetFormFields(m_FieldName,FieldArray); | 3415 GetFormFields(m_FieldName,FieldArray); |
3416 » if (FieldArray.GetSize() <= 0) return FALSE; | 3416 » if (FieldArray.GetSize() <= 0) return false; |
3417 | 3417 |
3418 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3418 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3419 ASSERT(pFormField != NULL); | 3419 ASSERT(pFormField != NULL); |
3420 | 3420 |
3421 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) | 3421 if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON) |
3422 » » return FALSE; | 3422 » » return false; |
3423 | 3423 |
3424 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); | 3424 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); |
3425 » if (!pFormControl)return FALSE; | 3425 » if (!pFormControl)return false; |
3426 | 3426 |
3427 CJS_Context* pContext = (CJS_Context*)cc; | 3427 CJS_Context* pContext = (CJS_Context*)cc; |
3428 ASSERT(pContext != NULL); | 3428 ASSERT(pContext != NULL); |
3429 | 3429 |
3430 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 3430 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
3431 ASSERT(pRuntime != NULL); | 3431 ASSERT(pRuntime != NULL); |
3432 | 3432 |
3433 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnI
D(*pRuntime, L"Icon")); | 3433 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDefnI
D(*pRuntime, L"Icon")); |
3434 » ASSERT(pObj.IsEmpty() == FALSE); | 3434 » ASSERT(pObj.IsEmpty() == false); |
3435 | 3435 |
3436 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); | 3436 CJS_Icon* pJS_Icon = (CJS_Icon*)JS_GetPrivate(pObj); |
3437 ASSERT(pJS_Icon != NULL); | 3437 ASSERT(pJS_Icon != NULL); |
3438 | 3438 |
3439 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); | 3439 Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject(); |
3440 ASSERT(pIcon != NULL); | 3440 ASSERT(pIcon != NULL); |
3441 | 3441 |
3442 CPDF_Stream* pIconStream = NULL; | 3442 CPDF_Stream* pIconStream = NULL; |
3443 if (nface == 0) | 3443 if (nface == 0) |
3444 pIconStream = pFormControl->GetNormalIcon(); | 3444 pIconStream = pFormControl->GetNormalIcon(); |
3445 else if (nface == 1) | 3445 else if (nface == 1) |
3446 pIconStream = pFormControl->GetDownIcon(); | 3446 pIconStream = pFormControl->GetDownIcon(); |
3447 else if (nface == 2) | 3447 else if (nface == 2) |
3448 pIconStream = pFormControl->GetRolloverIcon(); | 3448 pIconStream = pFormControl->GetRolloverIcon(); |
3449 else | 3449 else |
3450 » » return FALSE; | 3450 » » return false; |
3451 | 3451 |
3452 pIcon->SetStream(pIconStream); | 3452 pIcon->SetStream(pIconStream); |
3453 vRet = pJS_Icon; | 3453 vRet = pJS_Icon; |
3454 | 3454 |
3455 » return TRUE; | 3455 » return true; |
3456 } | 3456 } |
3457 | 3457 |
3458 //#pragma warning(default: 4800) | 3458 //#pragma warning(default: 4800) |
3459 | 3459 |
3460 FX_BOOL Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) | 3460 bool Field::buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
3461 { | 3461 { |
3462 #if 0 | 3462 #if 0 |
3463 ASSERT(m_pDocument != NULL); | 3463 ASSERT(m_pDocument != NULL); |
3464 | 3464 |
3465 CFX_PtrArray FieldArray; | 3465 CFX_PtrArray FieldArray; |
3466 GetFormFields(m_FieldName,FieldArray); | 3466 GetFormFields(m_FieldName,FieldArray); |
3467 » if (FieldArray.GetSize() <= 0) return FALSE; | 3467 » if (FieldArray.GetSize() <= 0) return false; |
3468 | 3468 |
3469 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3469 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3470 » if (!pFormField)return FALSE; | 3470 » if (!pFormField)return false; |
3471 | 3471 |
3472 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 3472 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
3473 ASSERT(pEnv); | 3473 ASSERT(pEnv); |
3474 | 3474 |
3475 CFX_WideString sIconFileName = pEnv->JS_fieldBrowse(); | 3475 CFX_WideString sIconFileName = pEnv->JS_fieldBrowse(); |
3476 if (sIconFileName.IsEmpty()) | 3476 if (sIconFileName.IsEmpty()) |
3477 { | 3477 { |
3478 vRet = 1; | 3478 vRet = 1; |
3479 » » return TRUE; | 3479 » » return true; |
3480 } | 3480 } |
3481 | 3481 |
3482 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 3482 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
3483 ASSERT(pInterForm != NULL); | 3483 ASSERT(pInterForm != NULL); |
3484 | 3484 |
3485 CPDF_Stream* pStream = pInterForm->LoadImageFromFile(sIconFileName); | 3485 CPDF_Stream* pStream = pInterForm->LoadImageFromFile(sIconFileName); |
3486 if (!pStream) | 3486 if (!pStream) |
3487 { | 3487 { |
3488 vRet = -1; | 3488 vRet = -1; |
3489 » » return TRUE; | 3489 » » return true; |
3490 } | 3490 } |
3491 | 3491 |
3492 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); | 3492 CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField); |
3493 » if (!pFormControl)return FALSE; | 3493 » if (!pFormControl)return false; |
3494 | 3494 |
3495 pFormControl->SetNormalIcon(pStream); | 3495 pFormControl->SetNormalIcon(pStream); |
3496 » UpdateFormControl(m_pDocument, pFormControl, TRUE, TRUE, TRUE); | 3496 » UpdateFormControl(m_pDocument, pFormControl, true, true, true); |
3497 | 3497 |
3498 vRet = 0; | 3498 vRet = 0; |
3499 #endif // 0 | 3499 #endif // 0 |
3500 » return TRUE; | 3500 » return true; |
3501 } | 3501 } |
3502 | 3502 |
3503 FX_BOOL Field::buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) | 3503 bool Field::buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
3504 { | 3504 { |
3505 » return FALSE; | 3505 » return false; |
3506 } | 3506 } |
3507 | 3507 |
3508 FX_BOOL Field::buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) | 3508 bool Field::buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
3509 { | 3509 { |
3510 » return FALSE; | 3510 » return false; |
3511 } | 3511 } |
3512 | 3512 |
3513 FX_BOOL Field::checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError) | 3513 bool Field::checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
3514 { | 3514 { |
3515 ASSERT(m_pDocument != NULL); | 3515 ASSERT(m_pDocument != NULL); |
3516 | 3516 |
3517 » if (!m_bCanSet) return FALSE; | 3517 » if (!m_bCanSet) return false; |
3518 | 3518 |
3519 int iSize = params.size(); | 3519 int iSize = params.size(); |
3520 if (iSize < 1) | 3520 if (iSize < 1) |
3521 » » return FALSE; | 3521 » » return false; |
3522 | 3522 |
3523 int nWidget = params[0].ToInt(); | 3523 int nWidget = params[0].ToInt(); |
3524 | 3524 |
3525 » FX_BOOL bCheckit = TRUE; | 3525 » bool bCheckit = true; |
3526 if (iSize >= 2) | 3526 if (iSize >= 2) |
3527 bCheckit = params[1].ToBool(); | 3527 bCheckit = params[1].ToBool(); |
3528 | 3528 |
3529 CFX_PtrArray FieldArray; | 3529 CFX_PtrArray FieldArray; |
3530 GetFormFields(m_FieldName,FieldArray); | 3530 GetFormFields(m_FieldName,FieldArray); |
3531 » if (FieldArray.GetSize() <= 0) return FALSE; | 3531 » if (FieldArray.GetSize() <= 0) return false; |
3532 | 3532 |
3533 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3533 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3534 ASSERT(pFormField != NULL); | 3534 ASSERT(pFormField != NULL); |
3535 | 3535 |
3536 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetF
ieldType() != FIELDTYPE_RADIOBUTTON) | 3536 if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX && pFormField->GetF
ieldType() != FIELDTYPE_RADIOBUTTON) |
3537 » » return FALSE; | 3537 » » return false; |
3538 if(nWidget <0 || nWidget >= pFormField->CountControls()) | 3538 if(nWidget <0 || nWidget >= pFormField->CountControls()) |
3539 » » return FALSE; | 3539 » » return false; |
3540 if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) | 3540 if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) |
3541 » » pFormField->CheckControl(nWidget, bCheckit, TRUE); | 3541 » » pFormField->CheckControl(nWidget, bCheckit, true); |
3542 else | 3542 else |
3543 » » pFormField->CheckControl(nWidget, bCheckit, TRUE); | 3543 » » pFormField->CheckControl(nWidget, bCheckit, true); |
3544 | 3544 |
3545 » UpdateFormField(m_pDocument, pFormField, TRUE, TRUE, TRUE); | 3545 » UpdateFormField(m_pDocument, pFormField, true, true, true); |
3546 » return TRUE; | 3546 » return true; |
3547 } | 3547 } |
3548 | 3548 |
3549 FX_BOOL Field::clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) | 3549 bool Field::clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError) |
3550 { | 3550 { |
3551 » return TRUE; | 3551 » return true; |
3552 } | 3552 } |
3553 | 3553 |
3554 FX_BOOL Field::defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) | 3554 bool Field::defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
3555 { | 3555 { |
3556 ASSERT(m_pDocument != NULL); | 3556 ASSERT(m_pDocument != NULL); |
3557 | 3557 |
3558 » if (!m_bCanSet) return FALSE; | 3558 » if (!m_bCanSet) return false; |
3559 | 3559 |
3560 int iSize = params.size(); | 3560 int iSize = params.size(); |
3561 if (iSize < 1) | 3561 if (iSize < 1) |
3562 » » return FALSE; | 3562 » » return false; |
3563 | 3563 |
3564 int nWidget = params[0].ToInt(); | 3564 int nWidget = params[0].ToInt(); |
3565 | 3565 |
3566 CFX_PtrArray FieldArray; | 3566 CFX_PtrArray FieldArray; |
3567 GetFormFields(m_FieldName,FieldArray); | 3567 GetFormFields(m_FieldName,FieldArray); |
3568 » if (FieldArray.GetSize() <= 0) return FALSE; | 3568 » if (FieldArray.GetSize() <= 0) return false; |
3569 | 3569 |
3570 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3570 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3571 ASSERT(pFormField != NULL); | 3571 ASSERT(pFormField != NULL); |
3572 | 3572 |
3573 if(nWidget <0 || nWidget >= pFormField->CountControls()) | 3573 if(nWidget <0 || nWidget >= pFormField->CountControls()) |
3574 { | 3574 { |
3575 » » vRet = FALSE; | 3575 » » vRet = false; |
3576 » » return FALSE; | 3576 » » return false; |
3577 } | 3577 } |
3578 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) | 3578 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) |
3579 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) | 3579 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) |
3580 { | 3580 { |
3581 | 3581 |
3582 » » vRet = TRUE; | 3582 » » vRet = true; |
3583 } | 3583 } |
3584 else | 3584 else |
3585 » » vRet = FALSE; | 3585 » » vRet = false; |
3586 | 3586 |
3587 » return TRUE; | 3587 » return true; |
3588 } | 3588 } |
3589 | 3589 |
3590 FX_BOOL Field::deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError) | 3590 bool Field::deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
3591 { | 3591 { |
3592 » return TRUE; | 3592 » return true; |
3593 } | 3593 } |
3594 | 3594 |
3595 int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) | 3595 int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) |
3596 { | 3596 { |
3597 ASSERT(ps1 != NULL); | 3597 ASSERT(ps1 != NULL); |
3598 ASSERT(ps2 != NULL); | 3598 ASSERT(ps2 != NULL); |
3599 | 3599 |
3600 return ps1->Compare(*ps2); | 3600 return ps1->Compare(*ps2); |
3601 } | 3601 } |
3602 | 3602 |
3603 | 3603 |
3604 FX_BOOL Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError) | 3604 bool Field::getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
3605 { | 3605 { |
3606 ASSERT(m_pDocument != NULL); | 3606 ASSERT(m_pDocument != NULL); |
3607 | 3607 |
3608 CFX_PtrArray FieldArray; | 3608 CFX_PtrArray FieldArray; |
3609 GetFormFields(m_FieldName,FieldArray); | 3609 GetFormFields(m_FieldName,FieldArray); |
3610 » if (FieldArray.GetSize() <= 0) return FALSE; | 3610 » if (FieldArray.GetSize() <= 0) return false; |
3611 | 3611 |
3612 CGW_ArrayTemplate<CFX_WideString*> swSort; | 3612 CGW_ArrayTemplate<CFX_WideString*> swSort; |
3613 | 3613 |
3614 for (int i=0,sz=FieldArray.GetSize(); i<sz; i++) | 3614 for (int i=0,sz=FieldArray.GetSize(); i<sz; i++) |
3615 { | 3615 { |
3616 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); | 3616 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.Element
At(i); |
3617 ASSERT(pFormField != NULL); | 3617 ASSERT(pFormField != NULL); |
3618 | 3618 |
3619 swSort.Add(new CFX_WideString(pFormField->GetFullName())); | 3619 swSort.Add(new CFX_WideString(pFormField->GetFullName())); |
3620 | 3620 |
3621 } | 3621 } |
3622 swSort.Sort(JS_COMPARESTRING); | 3622 swSort.Sort(JS_COMPARESTRING); |
3623 | 3623 |
3624 CJS_Context* pContext = (CJS_Context*)cc; | 3624 CJS_Context* pContext = (CJS_Context*)cc; |
3625 ASSERT(pContext != NULL); | 3625 ASSERT(pContext != NULL); |
3626 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 3626 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
3627 ASSERT(pRuntime != NULL); | 3627 ASSERT(pRuntime != NULL); |
3628 | 3628 |
3629 CJS_Array FormFieldArray(m_isolate); | 3629 CJS_Array FormFieldArray(m_isolate); |
3630 for (int j=0,jsz = swSort.GetSize(); j<jsz; j++) | 3630 for (int j=0,jsz = swSort.GetSize(); j<jsz; j++) |
3631 { | 3631 { |
3632 CFX_WideString* pStr = swSort.GetAt(j); | 3632 CFX_WideString* pStr = swSort.GetAt(j); |
3633 | 3633 |
3634 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_Get
ObjDefnID(*pRuntime, L"Field")); | 3634 JSFXObject pObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_Get
ObjDefnID(*pRuntime, L"Field")); |
3635 » » ASSERT(pObj.IsEmpty() == FALSE); | 3635 » » ASSERT(pObj.IsEmpty() == false); |
3636 | 3636 |
3637 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pObj); | 3637 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pObj); |
3638 ASSERT(pJSField != NULL); | 3638 ASSERT(pJSField != NULL); |
3639 | 3639 |
3640 Field* pField = (Field*)pJSField->GetEmbedObject(); | 3640 Field* pField = (Field*)pJSField->GetEmbedObject(); |
3641 ASSERT(pField != NULL); | 3641 ASSERT(pField != NULL); |
3642 | 3642 |
3643 pField->AttachField(m_pJSDoc, *pStr); | 3643 pField->AttachField(m_pJSDoc, *pStr); |
3644 | 3644 |
3645 CJS_Value FormFieldValue(m_isolate); | 3645 CJS_Value FormFieldValue(m_isolate); |
3646 FormFieldValue = pJSField; | 3646 FormFieldValue = pJSField; |
3647 FormFieldArray.SetElement(j, FormFieldValue); | 3647 FormFieldArray.SetElement(j, FormFieldValue); |
3648 | 3648 |
3649 delete pStr; | 3649 delete pStr; |
3650 } | 3650 } |
3651 | 3651 |
3652 vRet = FormFieldArray; | 3652 vRet = FormFieldArray; |
3653 swSort.RemoveAll(); | 3653 swSort.RemoveAll(); |
3654 » return TRUE; | 3654 » return true; |
3655 } | 3655 } |
3656 | 3656 |
3657 FX_BOOL Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) | 3657 bool Field::getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value
& vRet, CFX_WideString& sError) |
3658 { | 3658 { |
3659 ASSERT(m_pDocument != NULL); | 3659 ASSERT(m_pDocument != NULL); |
3660 int iSize = params.size(); | 3660 int iSize = params.size(); |
3661 | 3661 |
3662 int nIdx = -1; | 3662 int nIdx = -1; |
3663 if (iSize >= 1) | 3663 if (iSize >= 1) |
3664 nIdx = params[0].ToInt(); | 3664 nIdx = params[0].ToInt(); |
3665 | 3665 |
3666 » FX_BOOL bExport = TRUE; | 3666 » bool bExport = true; |
3667 if (iSize >= 2) | 3667 if (iSize >= 2) |
3668 bExport = params[1].ToBool(); | 3668 bExport = params[1].ToBool(); |
3669 | 3669 |
3670 CFX_PtrArray FieldArray; | 3670 CFX_PtrArray FieldArray; |
3671 GetFormFields(m_FieldName,FieldArray); | 3671 GetFormFields(m_FieldName,FieldArray); |
3672 » if (FieldArray.GetSize() <= 0) return FALSE; | 3672 » if (FieldArray.GetSize() <= 0) return false; |
3673 | 3673 |
3674 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3674 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3675 ASSERT(pFormField != NULL); | 3675 ASSERT(pFormField != NULL); |
3676 | 3676 |
3677 if ((pFormField->GetFieldType() == FIELDTYPE_LISTBOX) | 3677 if ((pFormField->GetFieldType() == FIELDTYPE_LISTBOX) |
3678 || (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX)) | 3678 || (pFormField->GetFieldType() == FIELDTYPE_COMBOBOX)) |
3679 { | 3679 { |
3680 if (nIdx == -1 || nIdx > pFormField->CountOptions()) | 3680 if (nIdx == -1 || nIdx > pFormField->CountOptions()) |
3681 nIdx = pFormField->CountOptions() -1; | 3681 nIdx = pFormField->CountOptions() -1; |
3682 if (bExport) | 3682 if (bExport) |
3683 { | 3683 { |
3684 CFX_WideString strval = pFormField->GetOptionValue(nIdx)
; | 3684 CFX_WideString strval = pFormField->GetOptionValue(nIdx)
; |
3685 if (strval.IsEmpty()) | 3685 if (strval.IsEmpty()) |
3686 vRet = pFormField->GetOptionLabel(nIdx).c_str(); | 3686 vRet = pFormField->GetOptionLabel(nIdx).c_str(); |
3687 else | 3687 else |
3688 vRet = strval.c_str(); | 3688 vRet = strval.c_str(); |
3689 } | 3689 } |
3690 else | 3690 else |
3691 vRet = pFormField->GetOptionLabel(nIdx).c_str(); | 3691 vRet = pFormField->GetOptionLabel(nIdx).c_str(); |
3692 } | 3692 } |
3693 else | 3693 else |
3694 » » return FALSE; | 3694 » » return false; |
3695 | 3695 |
3696 » return TRUE; | 3696 » return true; |
3697 } | 3697 } |
3698 | 3698 |
3699 FX_BOOL Field::getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError) | 3699 bool Field::getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
3700 { | 3700 { |
3701 » return FALSE; | 3701 » return false; |
3702 } | 3702 } |
3703 | 3703 |
3704 FX_BOOL Field::insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError) | 3704 bool Field::insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
3705 { | 3705 { |
3706 » return TRUE; | 3706 » return true; |
3707 } | 3707 } |
3708 | 3708 |
3709 FX_BOOL Field::isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError) | 3709 bool Field::isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
3710 { | 3710 { |
3711 ASSERT(m_pDocument != NULL); | 3711 ASSERT(m_pDocument != NULL); |
3712 | 3712 |
3713 int nIndex = -1; | 3713 int nIndex = -1; |
3714 if (params.size() >= 1) | 3714 if (params.size() >= 1) |
3715 nIndex = params[0].ToInt(); | 3715 nIndex = params[0].ToInt(); |
3716 | 3716 |
3717 CFX_PtrArray FieldArray; | 3717 CFX_PtrArray FieldArray; |
3718 GetFormFields(m_FieldName,FieldArray); | 3718 GetFormFields(m_FieldName,FieldArray); |
3719 » if (FieldArray.GetSize() <= 0) return FALSE; | 3719 » if (FieldArray.GetSize() <= 0) return false; |
3720 | 3720 |
3721 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3721 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3722 ASSERT(pFormField != NULL); | 3722 ASSERT(pFormField != NULL); |
3723 | 3723 |
3724 if(nIndex <0 || nIndex >= pFormField->CountControls()) | 3724 if(nIndex <0 || nIndex >= pFormField->CountControls()) |
3725 { | 3725 { |
3726 » » vRet = FALSE; | 3726 » » vRet = false; |
3727 » » return FALSE; | 3727 » » return false; |
3728 } | 3728 } |
3729 | 3729 |
3730 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) | 3730 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) |
3731 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) | 3731 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) |
3732 { | 3732 { |
3733 if (pFormField->GetControl(nIndex)->IsChecked() !=0 ) | 3733 if (pFormField->GetControl(nIndex)->IsChecked() !=0 ) |
3734 » » » vRet = TRUE; | 3734 » » » vRet = true; |
3735 else | 3735 else |
3736 » » » vRet = FALSE; | 3736 » » » vRet = false; |
3737 } | 3737 } |
3738 else | 3738 else |
3739 » » vRet = FALSE; | 3739 » » vRet = false; |
3740 | 3740 |
3741 » return TRUE; | 3741 » return true; |
3742 } | 3742 } |
3743 | 3743 |
3744 FX_BOOL Field::isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) | 3744 bool Field::isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
3745 { | 3745 { |
3746 ASSERT(m_pDocument != NULL); | 3746 ASSERT(m_pDocument != NULL); |
3747 | 3747 |
3748 int nIndex = -1; | 3748 int nIndex = -1; |
3749 if (params.size() >= 1) | 3749 if (params.size() >= 1) |
3750 nIndex = params[0].ToInt(); | 3750 nIndex = params[0].ToInt(); |
3751 | 3751 |
3752 CFX_PtrArray FieldArray; | 3752 CFX_PtrArray FieldArray; |
3753 GetFormFields(m_FieldName,FieldArray); | 3753 GetFormFields(m_FieldName,FieldArray); |
3754 » if (FieldArray.GetSize() <= 0) return FALSE; | 3754 » if (FieldArray.GetSize() <= 0) return false; |
3755 | 3755 |
3756 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3756 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3757 ASSERT(pFormField != NULL); | 3757 ASSERT(pFormField != NULL); |
3758 | 3758 |
3759 if(nIndex <0 || nIndex >= pFormField->CountControls()) | 3759 if(nIndex <0 || nIndex >= pFormField->CountControls()) |
3760 { | 3760 { |
3761 » » vRet = FALSE; | 3761 » » vRet = false; |
3762 » » return FALSE; | 3762 » » return false; |
3763 } | 3763 } |
3764 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) | 3764 if ((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) |
3765 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) | 3765 || (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)) |
3766 { | 3766 { |
3767 if (pFormField->GetControl(nIndex)->IsDefaultChecked() != 0) | 3767 if (pFormField->GetControl(nIndex)->IsDefaultChecked() != 0) |
3768 » » » vRet = TRUE; | 3768 » » » vRet = true; |
3769 else | 3769 else |
3770 » » » vRet = FALSE; | 3770 » » » vRet = false; |
3771 } | 3771 } |
3772 else | 3772 else |
3773 » » vRet = FALSE; | 3773 » » vRet = false; |
3774 | 3774 |
3775 » return TRUE; | 3775 » return true; |
3776 } | 3776 } |
3777 | 3777 |
3778 FX_BOOL Field::setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) | 3778 bool Field::setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value
& vRet, CFX_WideString& sError) |
3779 { | 3779 { |
3780 » return TRUE; | 3780 » return true; |
3781 } | 3781 } |
3782 | 3782 |
3783 FX_BOOL Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError) | 3783 bool Field::setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
3784 { | 3784 { |
3785 ASSERT(m_pDocument != NULL); | 3785 ASSERT(m_pDocument != NULL); |
3786 | 3786 |
3787 CFX_PtrArray FieldArray; | 3787 CFX_PtrArray FieldArray; |
3788 GetFormFields(m_FieldName,FieldArray); | 3788 GetFormFields(m_FieldName,FieldArray); |
3789 » if (FieldArray.GetSize() <= 0) return FALSE; | 3789 » if (FieldArray.GetSize() <= 0) return false; |
3790 | 3790 |
3791 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); | 3791 CPDF_FormField* pFormField = (CPDF_FormField*)FieldArray.ElementAt(0); |
3792 ASSERT(pFormField != NULL); | 3792 ASSERT(pFormField != NULL); |
3793 | 3793 |
3794 int32_t nCount = pFormField->CountControls(); | 3794 int32_t nCount = pFormField->CountControls(); |
3795 | 3795 |
3796 » if (nCount < 1) return FALSE; | 3796 » if (nCount < 1) return false; |
3797 | 3797 |
3798 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 3798 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
3799 ASSERT(pInterForm != NULL); | 3799 ASSERT(pInterForm != NULL); |
3800 | 3800 |
3801 CPDFSDK_Widget* pWidget = NULL; | 3801 CPDFSDK_Widget* pWidget = NULL; |
3802 if (nCount == 1) | 3802 if (nCount == 1) |
3803 { | 3803 { |
3804 pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); | 3804 pWidget = pInterForm->GetWidget(pFormField->GetControl(0)); |
3805 } | 3805 } |
3806 else | 3806 else |
3807 { | 3807 { |
3808 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 3808 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
3809 ASSERT(pEnv); | 3809 ASSERT(pEnv); |
3810 CPDF_Page* pPage = (CPDF_Page*)pEnv->FFI_GetCurrentPage(m_pDocum
ent->GetDocument()); | 3810 CPDF_Page* pPage = (CPDF_Page*)pEnv->FFI_GetCurrentPage(m_pDocum
ent->GetDocument()); |
3811 if(!pPage) | 3811 if(!pPage) |
3812 » » » return FALSE; | 3812 » » » return false; |
3813 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pP
age)) | 3813 if (CPDFSDK_PageView* pCurPageView = m_pDocument->GetPageView(pP
age)) |
3814 { | 3814 { |
3815 for (int32_t i=0; i<nCount; i++) | 3815 for (int32_t i=0; i<nCount; i++) |
3816 { | 3816 { |
3817 if (CPDFSDK_Widget* pTempWidget = pInterForm->G
etWidget(pFormField->GetControl(i))) | 3817 if (CPDFSDK_Widget* pTempWidget = pInterForm->G
etWidget(pFormField->GetControl(i))) |
3818 { | 3818 { |
3819 if (pTempWidget->GetPDFPage() == pCurPag
eView->GetPDFPage()) | 3819 if (pTempWidget->GetPDFPage() == pCurPag
eView->GetPDFPage()) |
3820 { | 3820 { |
3821 pWidget = pTempWidget; | 3821 pWidget = pTempWidget; |
3822 break; | 3822 break; |
3823 } | 3823 } |
3824 } | 3824 } |
3825 } | 3825 } |
3826 } | 3826 } |
3827 } | 3827 } |
3828 | 3828 |
3829 if (pWidget) | 3829 if (pWidget) |
3830 { | 3830 { |
3831 m_pDocument->SetFocusAnnot(pWidget); | 3831 m_pDocument->SetFocusAnnot(pWidget); |
3832 } | 3832 } |
3833 | 3833 |
3834 » return TRUE; | 3834 » return true; |
3835 } | 3835 } |
3836 | 3836 |
3837 FX_BOOL Field::setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError) | 3837 bool Field::setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
3838 { | 3838 { |
3839 » return TRUE; | 3839 » return true; |
3840 } | 3840 } |
3841 | 3841 |
3842 FX_BOOL Field::setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError) | 3842 bool Field::setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet, CFX_WideString& sError) |
3843 { | 3843 { |
3844 » return FALSE; | 3844 » return false; |
3845 } | 3845 } |
3846 | 3846 |
3847 FX_BOOL Field::signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters
& params, CJS_Value& vRet, CFX_WideString& sError) | 3847 bool Field::signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters& p
arams, CJS_Value& vRet, CFX_WideString& sError) |
3848 { | 3848 { |
3849 » return FALSE; | 3849 » return false; |
3850 } | 3850 } |
3851 | 3851 |
3852 FX_BOOL Field::signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError) | 3852 bool Field::signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, CFX_WideString& sError) |
3853 { | 3853 { |
3854 » return FALSE; | 3854 » return false; |
3855 } | 3855 } |
3856 | 3856 |
3857 FX_BOOL Field::signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) | 3857 bool Field::signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
3858 { | 3858 { |
3859 » return FALSE; | 3859 » return false; |
3860 } | 3860 } |
3861 | 3861 |
3862 FX_BOOL Field::signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& pa
rams, CJS_Value& vRet, CFX_WideString& sError) | 3862 bool Field::signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, CFX_WideString& sError) |
3863 { | 3863 { |
3864 » return FALSE; | 3864 » return false; |
3865 } | 3865 } |
3866 | 3866 |
3867 FX_BOOL Field::signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) | 3867 bool Field::signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
3868 { | 3868 { |
3869 » return FALSE; | 3869 » return false; |
3870 } | 3870 } |
3871 | 3871 |
3872 FX_BOOL Field::signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, CFX_WideString& sError) | 3872 bool Field::signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
3873 { | 3873 { |
3874 » return FALSE; | 3874 » return false; |
3875 } | 3875 } |
3876 | 3876 |
3877 FX_BOOL Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or) | 3877 bool Field::source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) |
3878 { | 3878 { |
3879 if (vp.IsGetting()) | 3879 if (vp.IsGetting()) |
3880 { | 3880 { |
3881 vp << (CJS_Object*)NULL; | 3881 vp << (CJS_Object*)NULL; |
3882 } | 3882 } |
3883 | 3883 |
3884 » return TRUE; | 3884 » return true; |
3885 } | 3885 } |
3886 | 3886 |
3887 /////////////////////////////////////////// delay //////////////////////////////
/////////////// | 3887 /////////////////////////////////////////// delay //////////////////////////////
/////////////// |
3888 | 3888 |
3889 void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) | 3889 void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) |
3890 { | 3890 { |
3891 ASSERT(m_pJSDoc != NULL); | 3891 ASSERT(m_pJSDoc != NULL); |
3892 | 3892 |
3893 CJS_DelayData* pNewData = new CJS_DelayData; | 3893 CJS_DelayData* pNewData = new CJS_DelayData; |
3894 pNewData->sFieldName = m_FieldName; | 3894 pNewData->sFieldName = m_FieldName; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4106 | 4106 |
4107 #define JS_FIELD_MINWIDTH 1 | 4107 #define JS_FIELD_MINWIDTH 1 |
4108 #define JS_FIELD_MINHEIGHT 1 | 4108 #define JS_FIELD_MINHEIGHT 1 |
4109 | 4109 |
4110 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType
, | 4110 void Field::AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType
, |
4111 const CFX_WideString& sN
ame, const CPDF_Rect& rcCoords) | 4111 const CFX_WideString& sN
ame, const CPDF_Rect& rcCoords) |
4112 { | 4112 { |
4113 //Not supported. | 4113 //Not supported. |
4114 } | 4114 } |
4115 | 4115 |
OLD | NEW |