Esempio n. 1
0
std::string
pf_Frag::getXMLID() const
{
    std::string ret = "";

    const PP_AttrProp* pAP = NULL;
    m_pPieceTable->getAttrProp( getIndexAP() ,&pAP );
    if( !pAP )
        return ret;
    const char* v = 0;
    
    if(getType() == pf_Frag::PFT_Object)
    {
        const pf_Frag_Object* pOb = static_cast<const pf_Frag_Object*>(this);

        if(pOb->getObjectType() == PTO_Bookmark)
        {
            if( pAP->getAttribute(PT_XMLID, v) && v)
            {
                ret = v;
            }
        }
        if(pOb->getObjectType() == PTO_RDFAnchor)
        {
            RDFAnchor a(pAP);
            ret = a.getID();
        }
    }
    if(getType() == pf_Frag::PFT_Strux)
    {
        const pf_Frag_Strux* pfs = static_cast<const pf_Frag_Strux*>(this);
        PTStruxType st = pfs->getStruxType();
        if( st == PTX_Block || st == PTX_SectionCell )
        {
            if(pAP->getAttribute("xml:id", v))
            {
                ret = v;
            }
        }
    }

    return ret;
}
Esempio n. 2
0
void PX_ChangeRecord_Span::coalesce(const PX_ChangeRecord_Span * pcr)
{
	// append the effect of the given pcr onto the end of us.

	// some quick sanity checks.  our caller is supposed to have already verified this
	
	UT_return_if_fail (getType() == pcr->getType());
	UT_return_if_fail (getIndexAP() == pcr->getIndexAP());

	m_length += pcr->getLength();

	if (pcr->getPosition() < getPosition())			// if we have a prepend (like a backspace)
	{
		m_position = pcr->getPosition();
		m_bufIndex = pcr->getBufIndex();
		m_blockOffset = pcr->getBlockOffset();
	}
	
	return;
}