FX_BOOL CPDF_FormControl::IsChecked() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); CFX_ByteString csAS = m_pWidgetDict->GetString("AS"); return csAS == csOn; }
FX_BOOL CPDF_FormControl::IsDefaultChecked() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV"); if (pDV == NULL) { return FALSE; } CFX_ByteString csDV = pDV->GetString(); CFX_ByteString csOn = GetOnStateName(); return (csDV == csOn); }
bool CPDF_FormControl::IsDefaultChecked() const { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV"); if (!pDV) return false; CFX_ByteString csDV = pDV->GetString(); CFX_ByteString csOn = GetOnStateName(); return (csDV == csOn); }
void CPDF_FormControl::CheckControl(FX_BOOL bChecked) { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); CFX_ByteString csOldAS = m_pWidgetDict->GetStringBy("AS", "Off"); CFX_ByteString csAS = "Off"; if (bChecked) csAS = csOn; if (csOldAS == csAS) return; m_pWidgetDict->SetAtName("AS", csAS); }
CFX_ByteString CPDF_FormControl::GetCheckedAPState() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); if (GetType() == CPDF_FormField::RadioButton || GetType() == CPDF_FormField::CheckBox) { if (ToArray(FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"))) { int iIndex = m_pField->GetControlIndex(this); csOn.Format("%d", iIndex); } } if (csOn.IsEmpty()) csOn = "Yes"; return csOn; }
CFX_ByteString CPDF_FormControl::GetCheckedAPState() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); if (GetType() == CPDF_FormField::RadioButton || GetType() == CPDF_FormField::CheckBox) { CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"); if (pOpt != NULL && pOpt->GetType() == PDFOBJ_ARRAY) { int iIndex = m_pField->GetControlIndex(this); csOn.Format("%d", iIndex); } } if (csOn.IsEmpty()) { csOn = "Yes"; } return csOn; }
CFX_WideString CPDF_FormControl::GetExportValue() const { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); if (GetType() == CPDF_FormField::RadioButton || GetType() == CPDF_FormField::CheckBox) { if (CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"))) { int iIndex = m_pField->GetControlIndex(this); csOn = pArray->GetStringAt(iIndex); } } if (csOn.IsEmpty()) csOn = "Yes"; return PDF_DecodeText(csOn); }
CFX_WideString CPDF_FormControl::GetExportValue() { ASSERT(GetType() == CPDF_FormField::CheckBox || GetType() == CPDF_FormField::RadioButton); CFX_ByteString csOn = GetOnStateName(); if (GetType() == CPDF_FormField::RadioButton || GetType() == CPDF_FormField::CheckBox) { CPDF_Object* pOpt = FPDF_GetFieldAttr(m_pField->m_pDict, "Opt"); if (pOpt != NULL && pOpt->GetType() == PDFOBJ_ARRAY) { int iIndex = m_pField->GetControlIndex(this); csOn = ((CPDF_Array*)pOpt)->GetString(iIndex); } } if (csOn.IsEmpty()) { csOn = "Yes"; } CFX_WideString csWOn = PDF_DecodeText(csOn); return csWOn; }