Пример #1
0
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;
}
Пример #2
0
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);
}
Пример #3
0
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);
}
Пример #4
0
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);
}
Пример #5
0
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;
}
Пример #6
0
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;
}
Пример #7
0
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);
}
Пример #8
0
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;
}