Click here to Skip to main content
11,494,174 members (68,891 online)
Click here to Skip to main content
Add your own
alternative version

Create a Universal Document Template which supports Dynamic Frame Window Layout

, 14 Dec 2002 41.1K 539 24
Introduce a programming technology to design a very complex, rich document type.
visualframework_src.zip
sample
ObjManager
res
ObjManager.manifest
VisualFrameWork
application.rgs
AtlForm.rgs
Board.rgs
DocumentCtrl.rgs
Documents.rgs
menuimg.bmp
Prairie Wind.bmp
res
Toolbar.bmp
VisualFrameWork.ico
VisualFrameWork.manifest
VisualFrameWorkDoc.ico
VisualFrameWork.rgs
VisualFrameWork.tlb
VisualFrameWork1
VisualFrameWork12
VisualFrameWork13
Demo1
Demo2
MfcViewLib
MfcViewLib.rgs
cnn.rgs
MfcViewLib.def
MfcViewLibps.def
AtlView2.rgs
AtlView3.rgs
vc70.tlb
VbComLib
VbComLib.vbproj.user
VCSharpComLib
VCSharpComLib.csproj.user
DemoDoc
Demo1
Demo2
Demo3
DocumentPropertyPage.rgs
New Document 2
New Document333
New Document 2dd
VBDoc
UD.dob
prjVBDoc.vbp
MSSCCPRJ.SCC
prjVBDoc.vbw
CNN
MSSCCPRJ.SCC
PrjCnn.vbw
PrjCnn.dll
PrjCnn.lib
PrjCnn.exp
cls.cls
PrjCnn.vbp
//*******************************************************************************
// 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
//*******************************************************************************
// DocumentCtrl.h : Declaration of the CDocumentCtrl

#ifndef __DOCUMENT_H_
#define __DOCUMENT_H_
#define DISPID_ICON						(-522)

#include "resource.h"       // main symbols
#include "VisualFrameWorkcp.h"
class CVisualFrameWorkDoc;
/////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////
// CDocumentCtrl
class ATL_NO_VTABLE CDocumentCtrl : public CTangramDocObj,
	public CComCoClass<CDocumentCtrl, &CLSID_Document>,
	public CComControl<CDocumentCtrl>,
	public IProvideClassInfo2Impl<&CLSID_Document, &DIID__IDocumentEvents, &LIBID_VisualFrameWorkLib>,
	public IPersistStreamInitImpl<CDocumentCtrl>,
	public CStockPropImpl<CDocumentCtrl, IDocument, &IID_IDocument, &LIBID_VisualFrameWorkLib>,
	public IOleObjectImpl<CDocumentCtrl>,
	public IViewObjectExImpl<CDocumentCtrl>,
	public IOleInPlaceObjectWindowlessImpl<CDocumentCtrl>,
	public IConnectionPointContainerImpl<CDocumentCtrl>,
	public CComObjectRootEx<CComSingleThreadModel>,
	public IOleControlImpl<CDocumentCtrl>,
	public IPersistStorageImpl<CDocumentCtrl>,
	public ISpecifyPropertyPagesImpl<CDocumentCtrl>,
	public IQuickActivateImpl<CDocumentCtrl>,
	public IPropertyNotifySinkCP<CDocumentCtrl>,
	public CProxy_IDocumentEvents< CDocumentCtrl >
{
public:
	CDocumentCtrl();
	~CDocumentCtrl();

DECLARE_REGISTRY_RESOURCEID(IDR_DOCUMENTCTRLEX)
DECLARE_NOT_AGGREGATABLE(CDocumentCtrl)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CDocumentCtrl)
	COM_INTERFACE_ENTRY(IDocument)
	COM_INTERFACE_ENTRY(IDispatch)
	COM_INTERFACE_ENTRY(IViewObjectEx)
	COM_INTERFACE_ENTRY(IViewObject2)
	COM_INTERFACE_ENTRY(IViewObject)
	COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
	COM_INTERFACE_ENTRY(IOleInPlaceObject)
	COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
	COM_INTERFACE_ENTRY(IOleControl)
	COM_INTERFACE_ENTRY(IOleObject)
	COM_INTERFACE_ENTRY(IPersistStreamInit)
	COM_INTERFACE_ENTRY(IConnectionPointContainer)
	COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
	COM_INTERFACE_ENTRY(IPersistStorage)
	COM_INTERFACE_ENTRY(IQuickActivate)
	COM_INTERFACE_ENTRY(IProvideClassInfo)
	COM_INTERFACE_ENTRY(IProvideClassInfo2)
	COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
	COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
END_COM_MAP()

BEGIN_PROP_MAP(CDocumentCtrl)
	PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
	PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
	PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
	//PROP_ENTRY("DocumentProperty", DISPID_DISPDOCPROPERTY, CLSID_DocumentPropertyPage)
	PROP_ENTRY("Picture", DISPID_PICTURE, CLSID_StockPicturePage)
	PROP_ENTRY("Text", DISPID_TEXT, CLSID_NULL)
END_PROP_MAP()

BEGIN_CONNECTION_POINT_MAP(CDocumentCtrl)
	CONNECTION_POINT_ENTRY(__uuidof(_IDocumentEvents))
	CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
	//CONNECTION_POINT_ENTRY(DIID__IDocumentEvents)
END_CONNECTION_POINT_MAP()

BEGIN_MSG_MAP(CDocumentCtrl)
	CHAIN_MSG_MAP(CComControl<CDocumentCtrl>)
	DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()

public:
    ULONG InternalRelease();
	void UpdateImages(UINT id);
	virtual void FinalRelease();
	virtual HRESULT FinalConstruct();

//--- Data Members
	BOOL m_bDesignMode; // current running mode
    BOOL m_bMDI;        // indicates MDI base window

// Handler prototypes:
//  LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
//  LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
//  LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);

// IViewObjectEx
	DECLARE_VIEW_STATUS(0)

// IDocument
public:
	virtual void ConnectExternalLib(CString strCnn);
	virtual HBITMAP GetBitmapFromDoc();
	void ShowPropertyPage();
	STDMETHOD(AddPage)(/*[in]*/long nPageIndex, /*[in]*/BSTR bstrTitle, /*[in]*/long nImageIndex);
	STDMETHOD(DeleteTabPage)(/*[in]*/long nTabIndex);
	STDMETHOD(DeleteTabWnd)();
	STDMETHOD(DeleteSplitter)();
	STDMETHOD(CreateTabWnd)(/*[in]*/BSTR bstrClsID,/*[in]*/BSTR bstrCaption,/*[in]*/BSTR bstrObjName);
	STDMETHOD(CreateActiveItem)(/*[in]*/BSTR bstrClsID, /*[in]*/BSTR bstrName);
	STDMETHOD(DocProperty)();
	STDMETHOD(CreateSplitter)(/*[in]*/BSTR RowCount, /*[in]*/BSTR ColCount, /*[in]*/BSTR bstrTitle, /*[in]*/BSTR bDock);
	STDMETHOD(get_MfcObjectX)(BSTR ObjName, /*[out, retval]*/ long *pVal);
	STDMETHOD(get_DocTitle)(/*[out, retval]*/ BSTR *pVal);
	STDMETHOD(put_DocTitle)(/*[in]*/ BSTR newVal);
	STDMETHOD(get_ObjectX)(/*[in]*/BSTR ObjName, /*[out, retval]*/ IDispatch** pVal);
	STDMETHOD(CreateDockBar)(/*[in]*/BSTR bstrCaption);
	CComBSTR m_bstrCaption;
	CComPtr<IPictureDisp> m_pPicture;
	CComBSTR m_bstrText;
	CTangramDoc* m_pDoc;
protected:
};

OBJECT_ENTRY_AUTO(__uuidof(Document), CDocumentCtrl)

#endif //__DOCUMENT_H_

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

dean170
Web Developer
China China
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.150520.1 | Last Updated 15 Dec 2002
Article Copyright 2002 by dean170
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid