Скачиваний:
8
Добавлен:
01.05.2014
Размер:
4 Кб
Скачать
// OLEAppDoc.h : interface of the COLEAppDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_OLEAPPDOC_H__02517716_0DCD_4374_8FC2_165F50E97EAC__INCLUDED_)
#define AFX_OLEAPPDOC_H__02517716_0DCD_4374_8FC2_165F50E97EAC__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "Hash.h"
#include "utils.h"

#define HINT_UPDATE_WINDOW  0
#define HINT_UPDATE_ITEM    1

class COLEAppSrvrItem;

class COLEAppDoc : public COleServerDoc
{
protected: // create from serialization only
	COLEAppDoc();
	DECLARE_DYNCREATE(COLEAppDoc)

// Attributes
public:
	COLEAppSrvrItem* GetEmbeddedItem()
		{ return (COLEAppSrvrItem*)COleServerDoc::GetEmbeddedItem(); }

	protected:
		COLORREF m_Color;		// Current drawing color
		WORD m_Element;			// Current element type
		CSize m_DocSize;        // Document size
		Hash<stringKey, CElement*> m_Hash;

// Operations
public:
		WORD GetElementType(){                     // Get the element type
			return m_Element;
		}

		COLORREF GetElementColor(){                // Get the element color
			return m_Color; 
		}

		Hash<stringKey, CElement*>::iterator& getHashIterator(){
			return m_Hash.getIterator();
		}

		Hash<stringKey, CElement*>::iterator getHashStart(){
			return m_Hash.begin();
		}

		Hash<stringKey, CElement*>::iterator getHashEnd(){
			return m_Hash.end();
		}

		Hash<stringKey, CElement*>::iterator findElement(string key){
			return m_Hash.find(stringKey(key));
		}

		bool AddElement(CElement* pElement, string key) {      // Add an element to the list
			pair<Hash<stringKey, CElement*>::iterator, bool> res = m_Hash.put(stringKey(key), pElement);
			return res.second;
		}

		CSize GetDocSize() {                      // Retrieve the document size
			return m_DocSize; 
		}

		void DeleteElement(string key);			 // Delete an element
		void SendToBack(CElement* pElement);      // Send element to start of list
		CRect GetDocExtent();                     // Get the bounding rectangle for the whole document

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(COLEAppDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	virtual BOOL OnUpdateDocument();
	virtual void OnSetItemRects(LPCRECT lpPosRect, LPCRECT lpClipRect);
	protected:
	virtual COleServerItem* OnGetEmbeddedItem();
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~COLEAppDoc();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(COLEAppDoc)
	afx_msg void OnElementLine();
	afx_msg void OnUpdateElementLine(CCmdUI* pCmdUI);
	afx_msg void OnElementTriangle();
	afx_msg void OnUpdateElementTriangle(CCmdUI* pCmdUI);
	afx_msg void OnElementTextintriangle();
	afx_msg void OnUpdateElementTextintriangle(CCmdUI* pCmdUI);
	afx_msg void OnElementText();
	afx_msg void OnUpdateElementText(CCmdUI* pCmdUI);
	afx_msg void OnColorBlack();
	afx_msg void OnUpdateColorBlack(CCmdUI* pCmdUI);
	afx_msg void OnColorBlue();
	afx_msg void OnUpdateColorBlue(CCmdUI* pCmdUI);
	afx_msg void OnColorGreen();
	afx_msg void OnUpdateColorGreen(CCmdUI* pCmdUI);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

	// Generated OLE dispatch map functions
	//{{AFX_DISPATCH(COLEAppDoc)
	afx_msg BOOL deleteElement(LPCTSTR key);
	afx_msg void showWindow();
	afx_msg void DrawLine(float x1, float y1, float x2, float y2, LPCTSTR text);
	afx_msg short getHashSize();
	//}}AFX_DISPATCH
	DECLARE_DISPATCH_MAP()
	DECLARE_INTERFACE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_OLEAPPDOC_H__02517716_0DCD_4374_8FC2_165F50E97EAC__INCLUDED_)
Соседние файлы в папке OLEApp