VADDON Definition of the VAddon add-on superclass Copyright Microsoft

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// VADDON.H - Definition of the VAddon add-on superclass.
// Copyright (C) Microsoft Corporation. All rights reserved.
//
// <summary>
// This header file contains the definition of a superclass for Visio add-ons.
// </summary>
//
#ifndef _VADDON_H
#define _VADDON_H
#include "vao.h"
#include <tchar.h>
#define INVALID_RESOURCE_ID ((UINT)(-1))
// VAddon - an add-on superclass
//
// <summary>
// The VAddon class serves as a superclass for Visio add-ons. Add-on classes
// that derive from VAddon must override the Run method and provide an
// implementation.
//
// Simplest case example is:
// ==================================================================
// #define ATTS (VAO_AOATTS_ISACTION | VAO_AOATTS_HASABOUT | VAO_AOATTS_WAITCRSR)
//
// class MyAddon : public VAddon {
// public:
// MyAddon(LPCTSTR pNameU, UINT uIDLocalName):VAddon(ATTS, VAO_ENABLEALWAYS, 0, 0, pName) { };
// VAORC Run(LPVAOV2LSTRUCT pV2L) { MessageBeep(0xFFFFFFFF); return VAORC_SUCCESS; };
// };
//
// MyAddon addon1("Addon 1", IDS_ADDON1);
// MyAddon addon2("Addon 2", IDS_ADDON2);
// ==================================================================
// </summary>
//
class VAddon
{
public:
// The one and only meaningful constructor:
VAddon(
// VAO_ORDINAL assigned automatically by this base class...
VAO_ATTS atts, // Attributes
VAO_ENABMASK enabMask, // Enabling policy
VAO_INVOKEMASK invokeOnMask,
VAO_NOTIFYMASK notifyOnMask,
LPCTSTR lpNameU, // Universal name for the add-on
UINT uIDLocalName= INVALID_RESOURCE_ID); // Resource ID for the local Name
virtual ~VAddon();
virtual VAORC IsEnabled(LPVAOV2LSTRUCT pV2L); // optionally overridden
virtual VAORC Run(LPVAOV2LSTRUCT pV2L)= 0; // the pure virtual which MUST be overridden
virtual VAORC About(LPVAOV2LSTRUCT pV2L); // optionally overridden
virtual VAORC Help(LPVAOV2LSTRUCT pV2L); // optionally overridden
virtual VAORC Load(WORD wVersion, LPVOID p); // optionally overridden
virtual VAORC Unload(WORD wParam, LPVOID p); // optionally overridden
virtual VAORC KillSession(LPVAOV2LSTRUCT pV2L); // optionally overridden
virtual HINSTANCE GetInstance(long nFlags= 0L); // optionally overridden
virtual HINSTANCE GetResourceHandle(); // optionally overridden
VAOREGSTRUCT* GetRegStructPtr(void);
inline WORD GetIndex(void) { return m_wIndex; };
inline TCHAR* GetName(void) {return m_szName;}
static VAddon* FindAddon(WORD wOrdinal);
static VAddon* GetFirst(void);
static VAddon* GetNext(VAddon* pCurrent); // returns NULL when no more.
static void SetInstance(HINSTANCE hInstance);
static void SetResoureHandle(HINSTANCE hInstance);
protected:
UINT m_uIDLocalName; // either INVALID_RESOURCE_ID or the ID of
// of a string resource in the instance
// GetInstance(); used to get the Local name
// from a resource in VAddon::Load
private:
WORD m_wIndex; // VAO_ORDINAL
// The wide character name members that will be used with m_reg.
WCHAR m_wszName[VAOMAXAONAME]; // Add-on local name
WCHAR m_wszNameU[VAOMAXAONAME]; // Add-on universal name
// Internal Name member. This will be local name if it exists.
// If the local name is blank it will be the universal name.
// If neither the universal or local name exists it will be blank.
// This name is returned By GetName() member of this class and
// is not initialized to the local or universal name until the load
// call.
TCHAR m_szName[VAOMAXAONAME];
// The VAOREGSTRUCT that describes this Add-on to Visio
VAOREGSTRUCT m_reg;
VAddon* m_pNext;
static VAddon* m_pFirst;
static VAddon* m_pLast;
static WORD m_wNextIndex;
static HINSTANCE m_hInstance;
static HINSTANCE m_hResourceHandle;
private:
// Unimplemented stuff to prevent compiler from generating default versions
// and to disallow end-user use:
VAddon();
VAddon(const VAddon &other);
operator=(const VAddon &other);
};
#endif // _VADDON_H