Esempio n. 1
0
void COleDocument::OnUpdateObjectVerbMenu(CCmdUI* pCmdUI)
{
	if (pCmdUI->m_pMenu == NULL || pCmdUI->m_pParentMenu == NULL)
	{
		// not a menu or is on sub-menu (don't recurse)
		pCmdUI->ContinueRouting();
		return;
	}

	// check for single selection
	COleClientItem* pItem = GetPrimarySelectedItem(GetRoutingView_());
	if (pItem == NULL || pItem->GetType() == OT_STATIC)
	{
		// no selection, or is 'static' item
		pCmdUI->Enable(FALSE);
	}

	// only include Convert... if there is a handler for ID_OLE_EDIT_CONVERT
	UINT nConvertID = ID_OLE_EDIT_CONVERT;
	AFX_CMDHANDLERINFO info;
	if (!OnCmdMsg(ID_OLE_EDIT_CONVERT, CN_COMMAND, NULL, &info))
		nConvertID = 0;

	// update the menu
	AfxOleSetEditMenu(GetPrimarySelectedItem(GetRoutingView_()),
		pCmdUI->m_pMenu, pCmdUI->m_nIndex,
		ID_OLE_VERB_FIRST, ID_OLE_VERB_LAST, nConvertID);
}
Esempio n. 2
0
BOOL COleDocument::OnCmdMsg(UINT nID, int nCode, void* pExtra,
		AFX_CMDHANDLERINFO* pHandlerInfo)
{
	ASSERT_VALID(this);

	if (nCode == CN_COMMAND && nID >= ID_OLE_VERB_FIRST && nID <= ID_OLE_VERB_LAST)
	{
		CView* pRoutingView = GetRoutingView_();
		COleClientItem* pSel = GetPrimarySelectedItem(pRoutingView);
		if (pSel != NULL)
		{
			if (pHandlerInfo != NULL)       // routing test
			{
				pHandlerInfo->pTarget = this;
				return TRUE;        // would be handled here
			}

			// activate the current selection with the appropriate verb
			CWaitCursor wait;
			pSel->DoVerb(nID - ID_OLE_VERB_FIRST, pRoutingView);
			return TRUE;    // handled
		}
	}
	return CDocument::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo);
}
Esempio n. 3
0
void COleDocument::OnEditLinks()
{
	ASSERT_VALID(this);

	COleLinksDialog dlg(this, GetRoutingView_());
	dlg.DoModal();
}
Esempio n. 4
0
void COleDocument::OnEditConvert()
{
	ASSERT_VALID(this);

	// get selected item
	COleClientItem* pItem = GetPrimarySelectedItem(GetRoutingView_());
	if (pItem == NULL)
		return;

	// do conversion dialog & convert for that item
	COleConvertDialog dlg(pItem);
	if (dlg.DoModal() == IDOK)
		dlg.DoConvert(pItem);
}
Esempio n. 5
0
void COleDocument::OnUpdateEditChangeIcon(CCmdUI* pCmdUI)
{
	ASSERT_VALID(this);

	pCmdUI->Enable(GetPrimarySelectedItem(GetRoutingView_()) != NULL);
}