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

PdfNamesTree * PoDoFo::PdfDocument::GetNamesTree ( bool  bCreate = ePdfCreateObject ) [inherited]

Get access to the Names dictionary (where all the named objects are stored) The returned PdfNamesTree object is owned by the PdfDocument.

Parameters:
bCreatecreate the object if it does not exist (ePdfCreateObject) or return NULL if it does not exist
Returns:
the Names dictionary

Definition at line 663 of file PdfDocument.cpp.

References PoDoFo::PdfDictionary::AddKey(), PoDoFo::ePdfDataType_Dictionary, PoDoFo::ePdfError_InvalidDataType, PoDoFo::PdfDocument::GetCatalog(), PoDoFo::PdfVariant::GetDataType(), PoDoFo::PdfVariant::GetDictionary(), PoDoFo::PdfDocument::GetNamedObjectFromCatalog(), PoDoFo::PdfElement::GetObject(), PODOFO_RAISE_ERROR, and PoDoFo::PdfObject::Reference().

Referenced by PoDoFo::PdfDocument::AddNamedDestination(), PoDoFo::PdfDocument::AttachFile(), and PoDoFo::PdfDestination::PdfDestination().

{
    PdfObject* pObj;

    if( !m_pNamesTree )
    {
        pObj = GetNamedObjectFromCatalog( "Names" );
        if( !pObj ) 
        {
            if ( !bCreate )
                return NULL;

            PdfNamesTree tmpTree ( &m_vecObjects );
            pObj = tmpTree.GetObject();
            this->GetCatalog()->GetDictionary().AddKey( "Names", pObj->Reference() );
            m_pNamesTree = new PdfNamesTree( pObj, this->GetCatalog() );
        } else if ( pObj->GetDataType() != ePdfDataType_Dictionary ) {
            PODOFO_RAISE_ERROR( ePdfError_InvalidDataType );
        } else
            m_pNamesTree = new PdfNamesTree( pObj, this->GetCatalog() );
    }        
    
    return m_pNamesTree;
}

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