#ifndef __HGOFDIMPL_HPP__ #define __HGOFDIMPL_HPP__ #include "HGOfd.h" extern "C" { #include "zip.h" }; #include "tinyxml2.h" #include #include #include class HGOfdReaderImpl { public: HGOfdReaderImpl(); ~HGOfdReaderImpl(); HGResult Open(const HGChar* fileName); HGResult Close(); HGResult GetPageCount(HGUInt* count); HGResult GetPageInfo(HGUInt page, HGOfdPageInfo* info); HGResult LoadImage(HGUInt page, HGFloat xScale, HGFloat yScale, HGUInt imgType, HGUInt imgOrigin, HGImage* image); private: HGResult ReadXml(const char *name, std::string &content); HGResult ReadJpeg(const char* name, HGJpegLoadInfo *info, HGFloat xScale, HGFloat yScale, HGUInt imgType, HGUInt imgOrigin, HGImage* image); private: zip* m_zip; std::vector m_contentNames; }; class HGOfdImageWriterImpl { public: HGOfdImageWriterImpl(); ~HGOfdImageWriterImpl(); HGResult Open(const HGChar* fileName); HGResult Close(); HGResult SaveJpegImage(HGImage image, const HGJpegSaveInfo* info); private: HGResult AddOfdXml(); HGResult AddDocXml(); HGResult AddDocResXml(); HGResult AddPublicResXml(); HGResult AddXmlFile(tinyxml2::XMLDocument &xmlDoc, const HGChar *name); HGResult AddJpegImageFile(HGImage image, const HGJpegSaveInfo* info, const HGChar* name); HGResult AddContentXmlFile(HGUInt index, HGFloat physicalWidth, HGFloat physicalHeight); private: zip* m_zip; std::list m_tmpFiles; HGUInt m_curImgIndex; }; #endif /* __HGOFDIMPL_HPP__ */