Beispiel #1
0
VARIANT_BOOL CAddinApp::IsButtonEnabled( UINT cmd_id )
{
	if (cmd_id == ID_About)
		return VARIANT_TRUE;

	Visio::IVApplicationPtr app = GetVisioApp();

	Visio::IVDocumentPtr doc;
	if (FAILED(app->get_ActiveDocument(&doc)) || doc == NULL)
		return VARIANT_FALSE;

	Visio::VisDocumentTypes doc_type = Visio::visDocTypeInval;
	if (FAILED(doc->get_Type(&doc_type)) || doc_type == Visio::visDocTypeInval)
		return VARIANT_FALSE;

	if (FAILED(doc->get_Type(&doc_type)) || doc_type == Visio::visDocTypeInval)
		return VARIANT_FALSE;

	Visio::IVWindowPtr window;
	if (FAILED(app->get_ActiveWindow(&window)) || window == NULL)
		return VARIANT_FALSE;

	if (GetActiveCommand() > 0)
		return VARIANT_TRUE;

	Visio::IVSelectionPtr selection;
	if (FAILED(window->get_Selection(&selection)) || selection == NULL)
		return VARIANT_FALSE;

	long count = 0;
	if (FAILED(selection->get_Count(&count)) || count == 0)
		return VARIANT_FALSE;

	return VARIANT_TRUE;
}
Beispiel #2
0
void CommandProcessorBase::SetUserLabel(const wxString& label)
{
    if (GetOpenCommand()) {
        ProcessOpenCommand(); // We need to make it non-pending, otherwise it may change after the label is set; which probably won't be what the user expects
    }

    CLCommand::Ptr_t command = GetActiveCommand();
    if (command) {
        command->SetUserLabel(label);
    }
}
Beispiel #3
0
VARIANT_BOOL CAddinApp::IsButtonPressed( UINT cmd_id )
{
	return (GetActiveCommand() == cmd_id) ? VARIANT_TRUE : VARIANT_FALSE;
}