00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #if !defined(AFX_ALBUMFOLDER_H__168CEF4D_1C6F_4E24_A647_299CBAEA6670__INCLUDED_)
00023 #define AFX_ALBUMFOLDER_H__168CEF4D_1C6F_4E24_A647_299CBAEA6670__INCLUDED_
00024
00025 #pragma once
00026
00027 class CLibrary;
00028 class CLibraryFile;
00029 class CCollectionFile;
00030 class CSchema;
00031 class CSchemaMember;
00032 class CXMLElement;
00033
00034
00035 class CAlbumFolder : public CComObject
00036 {
00037
00038 public:
00039 CAlbumFolder(CAlbumFolder* pParent = NULL, LPCTSTR pszSchemaURI = NULL, LPCTSTR pszName = NULL, BOOL bAutoDelete = FALSE);
00040 virtual ~CAlbumFolder();
00041
00042 DECLARE_DYNAMIC(CAlbumFolder)
00043
00044
00045 public:
00046 CAlbumFolder* m_pParent;
00047 CObList m_pFolders;
00048 CObList m_pFiles;
00049 public:
00050 CString m_sSchemaURI;
00051 CSchema* m_pSchema;
00052 CXMLElement* m_pXML;
00053 BOOL m_bCollSHA1;
00054 SHA1 m_pCollSHA1;
00055 public:
00056 CString m_sName;
00057 BOOL m_bExpanded;
00058 BOOL m_bAutoDelete;
00059 CString m_sBestView;
00060 public:
00061 DWORD m_nUpdateCookie;
00062 DWORD m_nSelectCookie;
00063 DWORD m_nListCookie;
00064 CCollectionFile* m_pCollection;
00065
00066
00067 public:
00068 CAlbumFolder* AddFolder(LPCTSTR pszSchemaURI = NULL, LPCTSTR pszName = NULL, BOOL bAutoDelete = FALSE);
00069 POSITION GetFolderIterator() const;
00070 CAlbumFolder* GetNextFolder(POSITION& pos) const;
00071 CAlbumFolder* GetFolder(LPCTSTR pszName) const;
00072 CAlbumFolder* GetFolderByURI(LPCTSTR pszURI) const;
00073 int GetFolderCount() const;
00074 BOOL CheckFolder(CAlbumFolder* pFolder, BOOL bRecursive = FALSE) const;
00075 CAlbumFolder* GetTarget(CSchemaMember* pMember, LPCTSTR pszValue) const;
00076 CAlbumFolder* FindCollection(SHA1* pSHA1);
00077 public:
00078 void AddFile(CLibraryFile* pFile);
00079 POSITION GetFileIterator() const;
00080 CLibraryFile* GetNextFile(POSITION& pos) const;
00081 int GetFileCount() const;
00082 int GetSharedCount() const;
00083 void RemoveFile(CLibraryFile* pFile);
00084 CAlbumFolder* FindFile(CLibraryFile* pFile) const;
00085 int GetFileList(CLibraryList* pList, BOOL bRecursive) const;
00086 public:
00087 void Delete(BOOL bIfEmpty = FALSE);
00088 BOOL SetMetadata(CXMLElement* pXML);
00089 BOOL MetaFromFile(CLibraryFile* pFile);
00090 BOOL MetaToFiles(BOOL bAggressive = FALSE);
00091 BOOL OrganiseFile(CLibraryFile* pFile);
00092 BOOL MountCollection(SHA1* pSHA1, CCollectionFile* pCollection, BOOL bForce = FALSE);
00093 CCollectionFile*GetCollection();
00094 CString GetBestView() const;
00095 protected:
00096 void SetCollection(SHA1* pSHA1, CCollectionFile* pCollection);
00097 void OnFolderDelete(CAlbumFolder* pFolder);
00098 void OnFileDelete(CLibraryFile* pFile);
00099 void Serialize(CArchive& ar, int nVersion);
00100 void Clear();
00101
00102 friend class CLibrary;
00103 friend class CLibraryFolders;
00104 friend class CLibraryFrame;
00105 friend class CLibraryTreeView;
00106 };
00107
00108 #endif // !defined(AFX_ALBUMFOLDER_H__168CEF4D_1C6F_4E24_A647_299CBAEA6670__INCLUDED_)