Пример #1
0
/*!
 * Implements the "insertStrux" method of the document listener class.
 * It takes the supplied change record and makes an XML-like representation
 * of it. Eventually these can either be stored in a file or sent over the
 * internet to a remote AbiWord where it can be translated back.
 */
bool ABI_Collab_Export::insertStrux(fl_ContainerLayout* sfh,
									const PX_ChangeRecord * pcr,
									pf_Frag_Strux* sdh,
									PL_ListenerId lid,
									void (* pfnBindHandles)(pf_Frag_Strux* sdhNew,
															PL_ListenerId lid,
															fl_ContainerLayout* sfhNew))
{
	if(pfnBindHandles)
	{
// Ugly hack for MSVC and GCC comlilant warnings
#ifdef __GNUC__
	#warning not sure
#else
	#pragma message("WARNING: not sure")
#endif

		fl_ContainerLayout* sfhNew = sfh; // WAS static_cast<fl_ContainerLayout*>(this);
		pfnBindHandles(sdh,lid,sfhNew);
	}

	ChangeRecordSessionPacket* newPacket = _buildPacket( pcr );
	UT_return_val_if_fail(newPacket, true); // unhandled change record type
	_handleNewPacket( newPacket, pcr );
	return true;
}
Пример #2
0
/*!
 * Implements the "change" method of the document listener class.
 * It takes the supplied change record and makes an XML-like representation
 * of it. Eventually these can either be stored in a file or sent over the
 * internet to a remote AbiWord where it can be translated back.
 */
bool ABI_Collab_Export::change(fl_ContainerLayout* /*sfh*/,
				const PX_ChangeRecord * pcr)
{
	// build new packet
	ChangeRecordSessionPacket * newPacket = _buildPacket( pcr );
	UT_return_val_if_fail(newPacket, true); // unhandled change record type

	// update internal state
	if (pcr->getType() == PX_ChangeRecord::PXT_GlobMarker) 
	{
		const PX_ChangeRecord_Glob * pcrg = static_cast<const PX_ChangeRecord_Glob *>(pcr);
		if (m_pGlobPacket) 
		{
			UT_return_val_if_fail(m_pGlobPacket->getPackets().size() > 0, true);
			UT_return_val_if_fail(m_pGlobPacket->getPackets()[0]->getClassType() == PCT_Glob_ChangeRecordSessionPacket, true);

			Glob_ChangeRecordSessionPacket* m_pOpeningGlobMarker = static_cast<Glob_ChangeRecordSessionPacket*>(m_pGlobPacket->getPackets()[0]);
			if (_isGlobEnd(m_pOpeningGlobMarker->m_iGLOBType, pcrg->getFlags())) 
			{	
				m_pGlobPacket->addPacket( newPacket );
				
				// push packet
				m_pAbiCollab->push( m_pGlobPacket );
				m_pAbiCollab->addChangeAdjust( new ChangeAdjust(
					*m_pGlobPacket, 
					(m_pAbiCollab->getActivePacket() ? m_pAbiCollab->getActivePacket()->getPos() : -1), 
					m_pDoc->getMyUUIDString()) 
					);

				// reset glob state
				DELETEP(m_pGlobPacket);
				m_pGlobPacket = 0;
				return true;
				
			} 
			else 
			{
				// not end of glob? then this must be at least true
				UT_return_val_if_fail(pcrg->getFlags() != PX_ChangeRecord_Glob::PXF_UserAtomicStart, false);
			}
		} 
		else 
		{
			m_pGlobPacket = new GlobSessionPacket( newPacket->getSessionId(), newPacket->getDocUUID() );
		}
	}

	_handleNewPacket( newPacket, pcr );
	return true;
}
Пример #3
0
/*!
 * Implements the "insertStrux" method of the document listener class.
 * It takes the supplied change record and makes an XML-like representation
 * of it. Eventually these can either be stored in a file or sent over the
 * internet to a remote AbiWord where it can be translated back.
 */
bool ABI_Collab_Export::insertStrux(PL_StruxFmtHandle /*sfh*/,
									const PX_ChangeRecord * pcr,
									PL_StruxDocHandle sdh,
									PL_ListenerId lid,
									void (* pfnBindHandles)(PL_StruxDocHandle sdhNew,
															PL_ListenerId lid,
															PL_StruxFmtHandle sfhNew))
{
	if(pfnBindHandles)
	{
		PL_StruxFmtHandle sfhNew = static_cast<PL_StruxFmtHandle>(this);
		pfnBindHandles(sdh,lid,sfhNew);
	}

	ChangeRecordSessionPacket* newPacket = _buildPacket( pcr );
	UT_return_val_if_fail(newPacket, true); // unhandled change record type
	_handleNewPacket( newPacket, pcr );
	return true;
}