コード例 #1
0
/*----------------------------------------------------------------------------------------------
	Set things up for editing with a temporary data cache by marking the point to return to
	in the undo stack. Also returns the action handler which should be installed in the
	temporary cache. This can be called multiple times. If the mark is already set, it does
	nothing.
	@return
----------------------------------------------------------------------------------------------*/
IActionHandler * AfDeFeEdBoxBut::BeginTempEdit()
{
	// Get your action handler.
	CustViewDaPtr qcvd;
	GetDataAccess(&qcvd);
	IActionHandlerPtr qacth;
	CheckHr(qcvd->GetActionHandler(&qacth));
	if (!m_hMark)
		CheckHr(qacth->Mark(&m_hMark));
	return qacth;
}
コード例 #2
0
/*----------------------------------------------------------------------------------------------
	End editing with a temporary data cache by clearing stuff out down to the mark created by
	BeginTempEdit. This can be called any number of times. If a mark is not in progress, it
	does nothing.
	@return
----------------------------------------------------------------------------------------------*/
IActionHandler * AfDeFeEdBoxBut::EndTempEdit()
{
	// Get your action handler.
	CustViewDaPtr qcvd;
	GetDataAccess(&qcvd);
	IActionHandlerPtr qacth;
	CheckHr(qcvd->GetActionHandler(&qacth));
	// Clear out any temporary Undo items relating to this window.
	if (m_hMark)
	{
		// Calling DiscardToMark() when the depth is greater than zero crashes.  (See DN-786.)
		int nDepth;
		CheckHr(qacth->get_CurrentDepth(&nDepth));
		if (nDepth == 0)
		{
			CheckHr(qacth->DiscardToMark(0));
			m_hMark = 0;
		}
	}
	return qacth;
}