Exemplo n.º 1
0
void COleDocument::CommitItems(BOOL bSuccess)
{
	// special 'Commit' phase for COleClientItem items
	POSITION pos = GetStartPosition();
	COleClientItem* pItem;
	while ((pItem = GetNextClientItem(pos)) != NULL)
	{
		// calling CommitItem with FALSE causes the object to revert
		//  to the original storage.  Calling CommitItem TRUE causes
		//  the item to adopt the new storage created in the Serialize
		//  function.
		pItem->CommitItem(bSuccess);
	}
}
Exemplo n.º 2
0
void COleDocument::CommitItems(BOOL bSuccess, LPSTORAGE pNewStorage)
{
	// special 'Commit' phase for COleClientItem items
	POSITION pos = GetStartPosition();
	COleClientItem* pItem;
	while ((pItem = GetNextClientItem(pos)) != NULL)
	{
		// Set m_lpNewStorage so we can pass it to IPersistStorage::SaveCompleted
		// in COleClientItem::CommitItem. m_bNeedCommit was set in
		// HandsOffStorage.
		if (pItem->m_bNeedCommit && pNewStorage)
		{
			if (pItem->m_lpNewStorage)
				pItem->m_lpNewStorage->Release();
			pNewStorage->AddRef();
			pItem->m_lpNewStorage = pNewStorage;
		}
		// calling CommitItem with FALSE causes the object to revert
		//  to the original storage.  Calling CommitItem TRUE causes
		//  the item to adopt the new storage created in the Serialize
		//  function.
		pItem->CommitItem(bSuccess);
	}
}