Click here to Skip to main content
15,886,578 members
Articles / Desktop Programming / MFC

Develop MFC Doc/View Application Which Supports Any Number Document Template

Rate me:
Please Sign up or sign in to vote.
1.57/5 (3 votes)
2 Jun 20052 min read 36.5K   1.7K   26  
This article provides an introduction to TangramLittle, a C++ Framework for MFC and the .NET Framework. Knowledge in MFC and the .NET Framework is assumed.
// TangramLittle Library - version 1.0
// Author:      Sunhui
// Modified by:
// Created:     2005-04-06
// Copyright:   (c) Sunhui
// Licence:     wxWindows licence
//
// This source code is a part of Tangram library.
// The use and distribution terms for this software are covered by the
// The wxWindows Library Licence (http://opensource.org/licenses/wxwindows.php)
// which can be found in the file licence.txt at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by
// the terms of this license. You must not remove this notice, or
// any other, from this software.

#pragma once

#include "DocumentInfo.h"
/*class CAXDocContFrameHook : public COleFrameHook
{
public:
	BOOL OnDocActivate(BOOL bActive);
	CAXDocContFrameHook(CFrameWnd* pFrameWnd, COleClientItem* pItem) : COleFrameHook(pFrameWnd, pItem)
	{
	}

	~CAXDocContFrameHook()
	{
		if (m_pFrameWnd != NULL&&::IsWindow(m_pFrameWnd->m_hWnd))
			if (::IsWindow(m_pFrameWnd->m_hWnd)&&m_pFrameWnd->m_pNotifyHook == this)
				m_pFrameWnd->m_pNotifyHook = NULL;
		m_pFrameWnd = NULL;
	}
	// Interface Maps
	DECLARE_INTERFACE_MAP()

	BEGIN_INTERFACE_PART(OleCommandTarget, IOleCommandTarget)
		INIT_INTERFACE_PART(CAXDocContFrameHook,OleCommandTarget);
		STDMETHOD(QueryStatus)(const GUID*, ULONG, OLECMD[], OLECMDTEXT*);
		STDMETHOD(Exec)(const GUID*, DWORD, DWORD, VARIANTARG*, VARIANTARG*);
	END_INTERFACE_PART(OleCommandTarget)
};*/



// CXDocument document
class CDocumentInfo;
class CXDocument : public COleDocument
{
	friend class CVbaProjectConnector;
	DECLARE_DYNCREATE(CXDocument)

public:
	CXDocument();
	virtual ~CXDocument();
	CDocumentInfo m_DocumentInfo;
	DWORD m_nVbaObjID;
	BOOL m_bMainDoc;
	BOOL m_bVBAPrj;
	CFrameWnd*				m_pFrame;

	//For VBA Support:
	CVbaProjectConnector* m_pVbaConnector;

	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);   // overridden for document i/o
	virtual void LoadFromStorage();
	virtual void SaveToStorage(CObject* pObject=NULL);
	virtual void OnExternalCommand(LPCTSTR command, LPCTSTR args);
	virtual IDispatch* GetDocDisp(void);
	BOOL GetRemember();
	BOOL GetSaveState();
	IStorage* GetStorage();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
	virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
	virtual void DeleteContents();
};

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



Comments and Discussions