// ************************************************************************************************************
// Author: Marcin Załęczny
// Release Date: 2010-11-08
// Licence: The GNU Lesser General Public License, version 3.0 (LGPLv3)
// ************************************************************************************************************
#ifndef __MZSTDXPS_XPS_METADATA_H__
#define __MZSTDXPS_XPS_METADATA_H__

#include "mzstdxpsCommon.h"
#include "mzXpsPrintTicket.h"
#include "mzXpsPagePrintTicket.h"
#include "mzObject.h"
#include "mzArrayList.h"


class DECLSPEC_MZSTDXPS CXpsMetadata : public CObject {
public:
	WINAPI CXpsMetadata();
    virtual WINAPI ~CXpsMetadata();
    
    VOID WINAPI addJobPT(CString PageMediaSize = L"A4", CString PageOrientation = L"Portrait", CString PageResolutionX = L"600", CString PageResolutionY = L"600");
    VOID WINAPI addMxdcEmptyPT();
    VOID WINAPI addPagePT(INT pagenum, CString PageMediaSize = L"A4", CString PageOrientation = L"Portrait", CString PageResolutionX = L"600", CString PageResolutionY = L"600");
    CXpsPagePrintTicket* WINAPI getPagePT(INT pagenum);
    VOID WINAPI addInMemoryThumbnailForPage(INT pagenum, BYTE* imageBuffer, DWORD bufferSize);
    VOID WINAPI addInMemoryThumbnail(CString filename, BYTE* imageBuffer, DWORD bufferSize);
    
    BOOL WINAPI saveToFiles(CString dirname);

private:
    CXpsPrintTicket* _jobPT;        // Set of files in 'XPS_HOME/Metadata/Job_PT.xml'
    CXpsPrintTicket* _mxdcEmptyPT;  // Set of files in 'XPS_HOME/Metadata/MXDC_Empty_PT.xml'
    CArrayList* _pagePTArray;       // Array of pointers CXpsPrintTicket* that holds page PTs (ex. Page1_PT.xml)
    CArrayList* _inMemoryThumbnails;// Array of pointers CXpsPrintTicket* that holds page PTs (ex. Page1_PT.xml)
    
    VOID WINAPI _releaseJobPT();
    VOID WINAPI _releaseMxdcEmptyPT();
    VOID WINAPI _releasePagePTArray();
    VOID WINAPI _releasePageInMemoryThumbnails();
};

#endif
