home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
gw
/
oddev.exe
/
ODMASAMP.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-07-15
|
6KB
|
174 lines
/* odmasamp.h - This file contains definitions, prototypes, etc. for the
sample ODMA implementation. */
#include <windows.h>
#include "odmacom.h"
#include "odmasamp.rh"
#define MAXDOCS 20 // Max. # of documents the sample app. supports
#define DMSNAME "ODMA 1.0 Sample DMS"
#define DMSID "ODMASAMP"
// Flags for Profile dialog window procedure
#define PROFILE_EDIT 1
#define NC(a,b) a##::##b
class Application {
public:
Application( LPUNKNOWN pUnkOuter, DWORD dwEnvData );
~Application();
HRESULT GetInterface( REFIID riid, LPVOID FAR *ppvObj );
private:
//----------------------------------------------------------------
// IUnknown implementation
//----------------------------------------------------------------
struct CUnknown : IUnknown {
CUnknown(Application *pObject) { m_pObject = pObject; }
//*** IUnknown ***
STDMETHOD(QueryInterface) (REFIID riid, LPVOID FAR* ppvObj);
STDMETHOD_(ULONG,AddRef) (VOID);
STDMETHOD_(ULONG,Release) (VOID);
private:
Application *m_pObject; // pointer to parent object
};
friend CUnknown;
CUnknown m_Unknown;
//----------------------------------------------------------------
// IODMDocMan interface
//----------------------------------------------------------------
struct CODMDocMan : IODMDocMan {
CODMDocMan(Application *pObject) { m_pObject = pObject; }
~CODMDocMan() {};
//*** IUnknown ***
STDMETHOD(QueryInterface) (REFIID riid, LPVOID FAR* ppvObj);
STDMETHOD_(ULONG,AddRef) (VOID);
STDMETHOD_(ULONG,Release) (VOID);
// *** IODMDocMan methods ***
STDMETHOD_(ODMSTATUS, SelectDoc)(LPSTR lpszDocId, LPDWORD pdwFlags );
STDMETHOD_(ODMSTATUS, OpenDoc)(DWORD flags, LPSTR lpszDocId,
LPSTR lpszDocLocation );
STDMETHOD_(ODMSTATUS, SaveDoc)(LPSTR lpszDocId, LPSTR lpszNewDocId );
STDMETHOD_(ODMSTATUS, CloseDoc)(LPSTR lpszDocId, DWORD activeTime,
DWORD pagesPrinted, LPVOID sessionData, WORD dataLen );
STDMETHOD_(ODMSTATUS, NewDoc)(LPSTR lpszDocId, DWORD dwFlags,
LPSTR lpszFormat, LPSTR lpszDocLocation );
STDMETHOD_(ODMSTATUS, SaveAs)(LPSTR lpszDocId, LPSTR lpszNewDocId,
LPSTR lpszFormat, ODMSAVEASCALLBACK pcbCallBack,
LPVOID pInstanceData );
STDMETHOD_(ODMSTATUS, Activate)(WORD action, LPSTR lpszDocId );
STDMETHOD_(ODMSTATUS, GetDocInfo)(LPSTR lpszDocId, WORD item,
LPSTR lpszData, WORD dataLen );
STDMETHOD_(ODMSTATUS, SetDocInfo)(LPSTR lpszDocId, WORD item,
LPSTR lpszData );
STDMETHOD_(ODMSTATUS, GetDMSInfo) (LPSTR lpszDmsId, LPWORD pwVerNo,
LPDWORD pdwExtensions );
STDMETHOD_(ODMSTATUS, GetLeadMoniker)(LPSTR lpszDocId,
LPMONIKER FAR *ppMoniker );
private:
Application *m_pObject; // pointer to parent object
};
friend CODMDocMan;
CODMDocMan m_ODMDocMan;
private:
// Internal data
DWORD m_dwRefs; // reference count
LPUNKNOWN m_pUnkOuter; // controlling IUnknown
HWND m_clientWind; // window handle from client
}; // Application
class Document {
private:
char DocId[80];
int SaveFlag;
char Author[30];
char Name[80];
char DocType[30];
char Format[30];
char DocLocation[ODM_FILENAME_MAX];
int OpenCount;
int DocAccessed; /* This flag tracks whether or not the application has
ever had a chance to access the document. It is u
used during SaveAs. */
void Init(void);
friend BOOL CALLBACK _export ProfileProc( HWND hwndDlg, UINT message, WPARAM wParam,
LPARAM lParam);
public:
Document();
~Document() {};
Document( LPSTR lpszFormat, LPSTR lpszDocLocation );
Document( Document *pOldDoc );
Document( LPSTR lpszDocId );
char *GetId( void ) { return DocId; };
int GetOpenCount( void ) { return OpenCount; };
ODMSTATUS Open( LPSTR lpszFileName );
ODMSTATUS Save() { SaveFlag = 1; return 0; };
ODMSTATUS Close( DWORD activeTime, DWORD pagesPrinted,
LPVOID sessionData, WORD dataLen );
ODMSTATUS EditAttributes( HWND hParent );
ODMSTATUS ShowAttributes( HWND hParent );
ODMSTATUS GetInfo( WORD item, LPSTR lpszData, WORD dataLen );
ODMSTATUS SetInfo( WORD item, LPSTR lpszData );
void SaveInfo( void );
int HasBeenAccessed( void ) { return DocAccessed; };
};
class DocumentList {
private:
Document *List[MAXDOCS];
public:
DocumentList();
~DocumentList();
void SaveList();
Document *GetDocumentByIndex( int n );
Document *GetDocumentById( LPSTR lpszDocId );
int GetDocumentIndexById( LPSTR lpszDocId );
ODMSTATUS NewDocument( LPSTR lpszFormat, LPSTR lpszDocLocation,
Document **ppDoc, DWORD dwFlags, HWND hParent );
ODMSTATUS CopyDocument( LPSTR lpszDocId, Document **ppDoc, HWND hParent );
ODMSTATUS DeleteDocument( LPSTR lpszDocId );
}; // DocumentList
// Structure definitions
typedef struct {
LPVOID pInstanceData;
ODMSAVEASCALLBACK pcbCallBack;
char Format[50];
} SaveAsData;
typedef struct {
Document *pDocument;
int Mode;
} ProDlgData;
// Globals
extern HINSTANCE NEAR hInst;
extern DocumentList NEAR DocList;
// Prototypes
BOOL CALLBACK _export SelectDocProc( HWND hwndDlg, UINT message, WPARAM wParam,
LPARAM lParam);
BOOL CALLBACK _export SaveAsProc( HWND hwndDlg, UINT message, WPARAM wParam,
LPARAM lParam);
BOOL CALLBACK _export ProfileProc( HWND hwndDlg, UINT message, WPARAM wParam,
LPARAM lParam);