Click here to Skip to main content
15,886,518 members
Articles / Desktop Programming / ATL

Create a Universal Document Template which supports Dynamic Frame Window Layout

Rate me:
Please Sign up or sign in to vote.
3.00/5 (8 votes)
14 Dec 20024 min read 49.3K   668   24  
Introduce a programming technology to design a very complex, rich document type.
//*******************************************************************************
// COPYRIGHT NOTES
// ---------------
// This source code is a part of Tangram library.
// You may use, compile or redistribute it as part of your application 
// for free. You cannot redistribute it as a part of a software development 
// library without the agreement of the author. If the sources are 
// distributed along with the application, you should leave the original 
// copyright notes in the source code without any changes.
// This code can be used WITHOUT ANY WARRANTIES on your own risk.
// 
// For the latest updates to this library, check site:
// http://www.tangramdev.com
// 
// sunhui
//*******************************************************************************
// TangramObject.h: interface for the CTangramObject class.
//
//////////////////////////////////////////////////////////////////////

#include "afx.h"

#pragma once
class CConnectObj;
class CDocCntrItem;
class CTangramCntrItem;

class CTangramObj : public CObject  
{
	DECLARE_SERIAL(CTangramObj)
public:
	CTangramObj();
	virtual ~CTangramObj();

	////////////////modify by sunhui////////
	BOOL bHooked;
	CLSID m_ObjClsID;
	IDispatch* m_pDisp;
	////////////////modify by sunhui////////
};

class CTangramObject : public CObject  
{
public:
	//////////////////modify by sunhui///////
	BOOL bDefineRegist;
	BOOL isRegist ;
	IDispatch* m_pDisp;
	IDispatch* m_pApcDisp;
	CObArray m_DataObArray;
	BOOL m_bHooked;
	//////////////////modify by sunhui///////
	HRESULT getAPCName(BSTR* pVal);
	HRESULT putAPCName(BSTR newName);

	DECLARE_SERIAL(CTangramObject)

	void AttachDocCntrItem();
	void DeleteChild();
	void Create();
	CTangramObject();
	virtual ~CTangramObject();


	CObArray m_ObArray;
	TangramContainerType m_ContainerType;
	TangramObjType m_TangramObjType;
	CString m_strObjID;				  // ActiveObject CLSID
	CString m_strExternalObjID;		  // External ActiveObject CLSID
	CString m_strExternalCnn;		  // External ActiveObject CLSID
	CString m_strName;
	CString m_strObjName;

	CTangramObject* m_pParentObject;

	int m_nRowIndex;						// Splitter view: row index
	int m_nColIndex;						// Splitter view: column index
	int m_nRows;							// Splitters: number of rows
	int m_nCols;							// Splitters: number of columns
	CSize m_Size;							// Splitter: initial size
	CSize m_SizeMin;							// Splitter: initial size
	CString m_strTitle;						// Title of this window
	UINT uiImageId;

	CArray<CTangramObject*, CTangramObject*&> m_ChildObjectMap;
	CWnd *m_pWnd;                     // Window associated with this object
	CObject *m_pMfcObj;                     // Window associated with this object
	CConnectObj *m_pConObj;
	CRuntimeClass *m_pRuntimeClass;			// Class of this window
	CDocCntrItem* m_pDocCntrItem;
	CTangramCntrItem* m_pObjCntrItem;
	HWND hComWnd;

	BOOL isDocking;
	BOOL InnerDoc;

	virtual void Serialize(CArchive& ar);
};

class CTangramDockingObjImpl : public CObject
{
	DECLARE_DYNCREATE(CTangramDockingObjImpl);
public:
	CTangramDockingObjImpl(void);
	virtual ~CTangramDockingObjImpl(void);

	CTangramObject* m_pTangramObject;
	CFrameWnd* m_pDockingFrame;
	CControlBar* m_pDockingWnd;
	CWnd* m_pWnd;
	HWND m_hWnd;

	virtual CFrameWnd* CreateDockingFrame(CString strTitle,CFrameWnd* pParentFrame);
	virtual void SetTangramObj(CTangramObject* pObj = NULL);
};

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


Written By
Web Developer
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions