Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

void PoDoFo::PdfField::Init ( PdfAcroForm pParent ) [private]

Initialize this PdfField.

Parameters:
pParentparent acro forms dictionary

Definition at line 77 of file PdfField.cpp.

References PoDoFo::PdfDictionary::AddKey(), PoDoFo::ePdfError_InternalLogic, PoDoFo::ePdfError_NoObject, PoDoFo::PdfVariant::GetArray(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDictionary::GetKey(), PoDoFo::PdfElement::GetObject(), PoDoFo::PdfReference::ObjectNumber(), PoDoFo::PdfLocaleImbue(), PODOFO_RAISE_ERROR, PoDoFo::PdfArray::push_back(), PoDoFo::PdfObject::Reference(), and PoDoFo::PdfAnnotation::SetBorderStyle().

Referenced by PdfField().

{
    // Insert into the parents kids array
    PdfObject* pFields = pParent->GetObject()->GetDictionary().GetKey( PdfName("Fields") );
    if( pFields ) 
    {
        pFields->GetArray().push_back( m_pObject->Reference() );
    }
    else
    {
        PODOFO_RAISE_ERROR( ePdfError_NoObject );
    }

    switch( m_eField ) 
    {
        case ePdfField_PushButton:
        case ePdfField_CheckBox:
        case ePdfField_RadioButton:
            m_pObject->GetDictionary().AddKey( PdfName("FT"), PdfName("Btn") );
            break;
        case ePdfField_TextField:
            m_pObject->GetDictionary().AddKey( PdfName("FT"), PdfName("Tx") );
            break;
        case ePdfField_ComboBox:
        case ePdfField_ListBox:
            m_pObject->GetDictionary().AddKey( PdfName("FT"), PdfName("Ch") );
            break;
        case ePdfField_Signature:
            m_pObject->GetDictionary().AddKey( PdfName("FT"), PdfName("Sig") );
            break;


        case ePdfField_Unknown:
        default:
        {
            PODOFO_RAISE_ERROR( ePdfError_InternalLogic );
        }
        break;
    }


    m_pWidget->SetBorderStyle( 0.0, 0.0, 5.0 );

    // Create a unique fieldname, because Acrobat Reader crashes if the field has no field name 
    std::ostringstream out;
    PdfLocaleImbue(out);
    out << "podofo_field_" << m_pObject->Reference().ObjectNumber();
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index