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