Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Customized Visual Studio .NET package: your fully integrated document window inside the IDE

, 20 Dec 2003
Create a fully integrated document window inside the Visual Studio IDE.
/**********************************************************************
- File Name: DocData.h
- Date: 12/10/2003 4:41:23 PM
- Author: Michael Sheinin
- Description : 
	The declaration of IVsPersistDocData and IPersistFileFormat interfaces.
	The number of methods, type of arguments and return values were obtained
	while tracing the original "bined" package activity.
	The CDocumentClass implements both interfaces above.
- Notes: 

**********************************************************************/
#pragma once

#include <unknwn.h>

// GUID defined in .CPP
//static const GUID IID_IVsPersistDocData = {0xD5D49C61,0x1C0B,0x4EA1,0x9A,0xDB,0xA7,0x9F,0xB1,0xDB,0xC7,0xB5};

interface IVsPersistDocData : public IUnknown
{
	virtual STDMETHODIMP PD_Stub3( void* p1 ) = 0;
	virtual STDMETHODIMP PD_Stub4( BOOL* pbDocNotSaved ) = 0;
	virtual STDMETHODIMP PD_Stub5( void* p1 ) = 0;
	virtual STDMETHODIMP PD_LoadDocData( LPCOLESTR wszFileName ) = 0;
	virtual STDMETHODIMP PD_SaveDocData( DWORD dwFlag, OUT LPWSTR* pbstr, OUT BOOL *pbCn ) = 0;
	virtual STDMETHODIMP PD_Stub8( void ) = 0;
	virtual STDMETHODIMP PD_Stub9( void* p1, void* p2, void* p3 ) = 0;
	virtual STDMETHODIMP PD_Stub10( void* p1, void* p2, void* p3, void* p4 ) = 0;
	virtual STDMETHODIMP PD_SetDocChanged( BOOL* pChanged ) = 0;
	virtual STDMETHODIMP PD_Stub12( void* p1 ) = 0;
};


// GUID defined in .CPP
//static const GUID IID_IPersistFileFormat = {0x3AFAE242,0xB530,0x11D0,0x81,0x99,0x00,0xA0,0xC9,0x1B,0xBE,0xE3};

interface IPersistFileFormat : public IUnknown
{
	virtual STDMETHODIMP PF_Stub3( void* p1 ) = 0;
	virtual STDMETHODIMP PF_Stub4( void* p1 ) = 0;
	virtual STDMETHODIMP PF_Stub5( void* p1 ) = 0;
	virtual STDMETHODIMP PF_Stub6( void* p1, void* p2, void* p3 ) = 0;
	virtual STDMETHODIMP PF_Save( LPCWSTR szFName, BOOL bRem, DWORD nFormIndx ) = 0;
	virtual STDMETHODIMP PF_Stub8( void* p1 ) = 0;
	virtual STDMETHODIMP PF_Stub9( LPCWSTR* psz1, LPCWSTR* psz2 ) = 0;
	virtual STDMETHODIMP PF_Stub10( LPCWSTR* p1 ) = 0;
};


class CMediator;
class CHistogram;
class CFileInfo;


class CDocumentData : public IVsPersistDocData, public IPersistFileFormat
{
public:
	//class
	CDocumentData();
	~CDocumentData();
	void Attach( CMediator* pMdtr );
	//IUnknown:
	STDMETHODIMP QueryInterface( REFIID rid, void** ppvObject );
	STDMETHODIMP_(ULONG) AddRef();
	STDMETHODIMP_(ULONG) Release();
	//IVsPeristDocData
	STDMETHODIMP PD_Stub3( void* p1 );
	STDMETHODIMP PD_Stub4( BOOL* pbDocNotSaved );
	STDMETHODIMP PD_Stub5( void* p1 );
	STDMETHODIMP PD_LoadDocData( LPCOLESTR wszFileName );
	STDMETHODIMP PD_SaveDocData( DWORD dwFlag, OUT LPWSTR* pbstr, OUT BOOL *pbCn );
	STDMETHODIMP PD_Stub8( void );
	STDMETHODIMP PD_Stub9( void* p1, void* p2, void* p3 );
	STDMETHODIMP PD_Stub10( void* p1, void* p2, void* p3, void* p4 );
	STDMETHODIMP PD_SetDocChanged( BOOL* pChanged );
	STDMETHODIMP PD_Stub12( void* p1 );
	//IPersistFileFormat
	STDMETHODIMP PF_Stub3( void* p1 );
	STDMETHODIMP PF_Stub4( void* p1 );
	STDMETHODIMP PF_Stub5( void* p1 );
	STDMETHODIMP PF_Stub6( void* p1, void* p2, void* p3 );
	STDMETHODIMP PF_Save( LPCWSTR szFName, BOOL bRem, DWORD nFormIndx );
	STDMETHODIMP PF_Stub8( void* p1 );
	STDMETHODIMP PF_Stub9( LPCWSTR* p1, LPCWSTR* p2 );
	STDMETHODIMP PF_Stub10( LPCWSTR* p1 );

	// Demo functionality:
	inline DWORD QueryCommandsState() { return m_dwCmdState; };
	HRESULT  ExecCommand(ULONG uCmdID);

protected:
	ULONG m_uRefCnt;
	LPCWSTR m_szFileName;
	CMediator* m_pMdtr;
	// Demo functionality 
	CHistogram*		m_pHist;
	CFileInfo*		m_pInfo;
	DWORD			m_dwCmdState;
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Michael Sheinin
Web Developer
United States United States
For the last 7 years I have developed software in real-time/embedded and MS-Windows environments for military and civil markets. I hold B.Sc. degree in computer engineering. Living in Ontario, Canada, I like hiking and traveling in general. Currently, I'm looking for employment opportunity inside the GTA.

| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 21 Dec 2003
Article Copyright 2003 by Michael Sheinin
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid