// ProjectDoc.h : interface of the CProjectDoc class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(_PROJECTDOC_H_)
#define _PROJECTDOC_H_

#include "XmlProject.h"
#include "cmString.h"

class CXmlBaseElement;

enum enUpdateViewReason
{
	enUpdateViewReason_None = 0,
	enUpdateViewReason_DocLoaded,
	enUpdateViewReason_SelectionChanged,
	enUpdateViewReason_ItemNameChanged,
	enUpdateViewReason_ItemChanged,
	enUpdateViewReason_BeforeSaveDoc
};

class CProjectDoc : public CDocument
{
protected: // create from serialization only
	CProjectDoc();
	DECLARE_DYNCREATE(CProjectDoc)

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CProjectDoc)
	public:
	virtual BOOL OnNewDocument();
	virtual void Serialize(CArchive& ar);
	virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
	virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
	virtual void SetPathName(LPCTSTR lpszPathName, BOOL bAddToMRU = TRUE);
	virtual void SetTitle(LPCTSTR lpszTitle);
	//}}AFX_VIRTUAL

public:
	CXmlProject* GetProject() { return &project_;}

	void SetDisplayRootNode(bool displayRootNode);
	bool GetDisplayRootNode() const;

	void SetSelectedItemId(const cmString& id);
	cmString GetSelectedItemId() const;
	CXmlBaseElement* GetElementById(const cmString& id);

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

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CProjectDoc)
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

protected:
	CXmlProject project_;
	bool displayRootNode_;

	cmString selectedItemId_;
};

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

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

#endif // !defined(_PROJECTDOC_H_)
