#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: bool ReadXml(const char *name, std::string &content); bool ReadJpeg(const char* name, 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, HGUInt quality); private: bool AddOfdXml(); bool AddDocXml(); bool AddDocResXml(); bool AddPublicResXml(); bool AddXmlFile(tinyxml2::XMLDocument &xmlDoc, const HGChar *name); bool AddJpegImageFile(HGImage image, const HGJpegSaveInfo* info, HGUInt quality, const HGChar* name); bool AddContentXmlFile(HGUInt index, HGFloat physicalWidth, HGFloat physicalHeight); private: zip* m_zip; std::list m_tmpFiles; HGUInt m_curImgIndex; }; #endif /* __HGOFDIMPL_HPP__ */