コード例 #1
0
ファイル: olecli3.cpp プロジェクト: shuowen/OpenNT
BOOL COleClientItem::ActivateAs(LPCTSTR lpszUserType,
                                REFCLSID clsidOld, REFCLSID clsidNew)
{
    ASSERT_VALID(this);
    ASSERT(lpszUserType == NULL || AfxIsValidString(lpszUserType));
    ASSERT(m_lpObject != NULL);

    // enable activate as
    m_scLast = _AfxOleDoTreatAsClass(lpszUserType, clsidOld, clsidNew);
    if (FAILED(m_scLast))
        return FALSE;

    // reload all items in this doucment
    COleDocument* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    POSITION pos = pDoc->GetStartPosition();
    COleClientItem* pItem;
    while ((pItem = pDoc->GetNextClientItem(pos)) != NULL)
    {
        // reload it, so activate as works as appropriate
        pItem->Reload();
    }

    ASSERT_VALID(this);
    return TRUE;
}
コード例 #2
0
ファイル: olecli2.cpp プロジェクト: anyue100/winscp
BOOL COleFrameHook::NotifyAllInPlace(
	BOOL bParam, BOOL (COleFrameHook::*pNotifyFunc)(BOOL bParam))
{
	ASSERT_VALID(this);
	HWND hWndFrame = m_hWnd;
	CWinApp* pApp = AfxGetApp();

	// no doc manager - no templates
	if (pApp->m_pDocManager == NULL)
		return TRUE;

	// walk all templates in the application
	CDocTemplate* pTemplate;
	POSITION pos = pApp->m_pDocManager->GetFirstDocTemplatePosition();
	while (pos != NULL)
	{
		pTemplate = pApp->m_pDocManager->GetNextDocTemplate(pos);
		ASSERT_VALID(pTemplate);
		ASSERT_KINDOF(CDocTemplate, pTemplate);

		// walk all documents in the template
		POSITION pos2 = pTemplate->GetFirstDocPosition();
		while (pos2)
		{
			COleDocument* pDoc = (COleDocument*)pTemplate->GetNextDoc(pos2);
			ASSERT_VALID(pDoc);
			if (pDoc->IsKindOf(RUNTIME_CLASS(COleDocument)))
			{
				// walk all COleClientItem objects in the document
				COleClientItem* pItem;
				POSITION pos3 = pDoc->GetStartPosition();
				while ((pItem = pDoc->GetNextClientItem(pos3)) != NULL)
				{
					if (pItem->m_pInPlaceFrame != NULL &&
						pItem->m_pInPlaceFrame->m_lpActiveObject != NULL &&
						pItem->m_pView != NULL &&
						AfxIsDescendant(hWndFrame, pItem->m_pView->m_hWnd))
					{
						// Whew!  Found an in-place active item that is
						//  part of this frame window hierarchy.
						COleFrameHook* pNotifyHook = pItem->m_pInPlaceFrame;
						if (!(pNotifyHook->*pNotifyFunc)(bParam))
							return FALSE;
					}
				}
			}
		}
	}
	return TRUE;
}
コード例 #3
0
ファイル: olesvr2.cpp プロジェクト: rickerliang/OpenNT
void COleServerItem::OnUpdateItems()
{
	COleDocument* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// update all of the embedded objects
	POSITION pos = pDoc->GetStartPosition();
	COleClientItem* pItem;
	while ((pItem = pDoc->GetNextClientItem(pos)) != NULL)
	{
		// update any out-of-date item
		if (pItem->m_lpObject->IsUpToDate() != NULL)
			pItem->m_lpObject->Update();
	}
}
コード例 #4
0
ファイル: olesvr2.cpp プロジェクト: rickerliang/OpenNT
BOOL COleServerItem::OnQueryUpdateItems()
{
	COleDocument* pDoc = GetDocument();
	ASSERT_VALID(pDoc);

	// update all of the embedded objects
	POSITION pos = pDoc->GetStartPosition();
	COleClientItem* pItem;
	while ((pItem = pDoc->GetNextClientItem(pos)) != NULL)
	{
		// if any item is out-of-date, then this item is out-of-date
		if (pItem->m_lpObject->IsUpToDate() != NULL)
			return TRUE;    // update needed
	}
	return FALSE;   // update not needed
}