0
# pragma once
# endif// _MSC_VER> 1000
# include "Razdels.h"
class CBookClass;
extern void RenewTree (CTreeCtrl *, CBookClass *);
extern void RenewList (CListCtrl *, CBookClass *);
class CBookClass: public CObject
{
DECLARE_SERIAL (CBookClass)
private:
CRazdels m_Razdels;
CPtrArray m_pPages;
CTreeCtrl * pTreeCtrl;
CListCtrl * pListCtrl;
CString m_Name;
WORD m_ActivePage;
void RenewCtrls ()
{
RenewTree (pTreeCtrl, this);
RenewList (pListCtrl, this);
}
public:
CRazdels * GetRazdels ()
{
return & M_Razdels;
}
CPtrArray * GetPages ()
{
return & M_pPages;
}
void SetTreeCtrl (CTreeCtrl * TreeCtrl)
{
pTreeCtrl = TreeCtrl;}
void SetListCtrl (CListCtrl * ListCtrl)
{
pListCtrl = ListCtrl;
}
CString * GetName ()
{
return & M_Name;
}
WORD GetActivePage ()
{
return m_ActivePage;
}
void SetActivePage (WORD Page)
{
m_ActivePage = Page;
RenewList (pListCtrl, this);
}
void SetPreviousActivePage ()
{
if (M_ActivePage> 0)
{
m_ActivePage -;
RenewCtrls ();
}
}
void SetNextActivePage ()
{
if (M_ActivePage +1
{
m_ActivePage + +;
RenewCtrls ();
}
}
CBookClass ();
~ CBookClass ();
void Serialize (CArchive &);
};
BookClass.cpp:
# include "Stdafx.h"
# include "BookClass.h"
IMPLEMENT_SERIAL (CBookClass, CObject, 0)
CBookClass :: CBookClass ()
{
m_ActivePage = 0;
}
CBookClass :: ~ CBookClass ()
{
m_Razdels.DeleteRazdels ();
}
void CBookClass :: Serialize (CArchive & ar)
{
m_Razdels.DeleteRazdels ();
m_pPages.RemoveAll ();
m_ActivePage = 0;
CObject :: Serialize (ar);
if (ar.IsLoading ())
{
ar>> m_Name;
WORD Count, Counter;
ar>> Count;
for (Counter = 0; Counter
{
CRazdel * Razdel = new CRazdel;
Razdel-> Serialize (ar);
m_Razdels.Add (Razdel);
}
for (Counter = 0; Counter
{
CRazdel * Razdel = (CRazdel *) m_Razdels.GetAt (Counter);
for (WORD Counter2 = 0; Counter2 GetGlavas () -> GetSize (); Counter2 + +)
{
CGlava * Glava = (CGlava *) Razdel-> GetGlavas () -> GetAt (Counter2);
for (WORD Counter3 = 0; Counter3 GetPages ...