//===========================================================================
// Summary:
//		IDPKDocÊÇ¸ºÔðÎÄµµ´ò¿ª£¬»ñÈ¡ÎÄµµÒ»Ð©ÊôÐÔµÄ½Ó¿ÚÀà¡£ 
// Usage:
//		Ê¹ÓÃDPK_CreateDoc½øÐÐ´´½¨£¬Ê¹ÓÃDPK_DestoryDocÏú»Ù¡£
// Remarks:
//		Null
// Date:
//		2011-9-15
// Author:
//		Zhang JingDan (zhangjingdan@duokan.com)
//===========================================================================

#ifndef __KERNEL_PDFKIT_PDFLIB_IDKPDOC_H__
#define __KERNEL_PDFKIT_PDFLIB_IDKPDOC_H__

//===========================================================================

#include "KernelRetCode.h"
#include "DKPTypeDef.h"

class IDKPOutline;
class IDKPPage;
class IDKPPageEx;
class IDkStream;

//===========================================================================

class IDKPDoc
{
public:
    enum REARRANGE_PAGE_POSITION_TYPE
    {
        PREV_PAGE,      // ÖØÅÅÉÏÒ»Ò³
        LOCATION_PAGE,  // ¸ù¾ÝÎ»ÖÃÌø×ªµÄÖØÅÅÒ³
        NEXT_PAGE,      // ÖØÅÅÏÂÒ»Ò³
    };

	//-------------------------------------------
	// Summary:
	//		´ò¿ªÎÄµµ¡£
	// Parameters:
	//		[in] pFileOP - Ä¿±êÎÄµµÎÄ¼þ¾ä±ú¡£
	// Returns£º
	//		³É¹¦Ôò·µ»ØDKR_OK£¬Èç¹ûÐèÒª¿ÚÁîÔò·µ»Ø DKR_PDF_NEED_READ_PASSWORD£¬´ò¿ªÊ§°ÜÔò·µ»ØDKR_FAILED¡£	
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_ReturnCode OpenDoc(IDkStream* pFileOP) = 0;

    //-------------------------------------------
    // Summary:
    //		´«Èë¿ÚÁîÒÔ´ò¿ªÎÄµµ¡£
    // Parameters:
    //		[in] pFileOP - Ä¿±êÎÄµµÎÄ¼þ¾ä±ú¡£
    //		[in] pPwd - ÃÜÂë¡£
    //      [in] length - ÃÜÂë³¤¶È¡£
    // Returns£º
    //		³É¹¦Ôò·µ»ØDK_TRUE£¬Èç¹ûÐèÒª¿ÚÁîµ«´«Èë¿ÚÁî´íÎó£¬Ôò·µ»Ø DKR_PDF_READ_PASSWORD_INCORRECT£¬´ò¿ªÊ§°ÜÔò·µ»ØDK_FALSE¡£	
    // SDK Version:
    //		´ÓDKP 2.2.0¿ªÊ¼Ö§³Ö
    //-------------------------------------------
    virtual DK_ReturnCode OpenDoc(IDkStream* pFileOP, const DK_BYTE* pPwd, DK_INT length) = 0;

	//-------------------------------------------
	// Summary:
	//		¹Ø±ÕÎÄµµ¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_VOID CloseDoc() = 0;

	//-------------------------------------------
	// Summary:
	//		»ñµÃÒ³Êý¡£
	// Returns:
	//		³É¹¦Ôò·µ»ØÒ³Êý£¬·ñÔò·µ»Ø-1¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_INT GetPageCount() = 0;

	//-------------------------------------------
	// Summary:
	//		»æÖÆÖ¸¶¨Ò³ÃæÄÚÈÝ¡£
	// Parameters:
	//		[in] parrRenderInfo	- »æÖÆ²ÎÊý¡£
	// Returns:
	//		»æÖÆ³É¹¦Ôò·µ»Ø1£¬Ê§°ÜÔò·µ»ØÆäËûÖµ¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_INT RenderPage(DK_RENDERINFO* parrRenderInfo) = 0;

	//-------------------------------------------
	// Summary:
	//		»ñµÃÖ¸¶¨Ò³ÂëµÄÒ³¶ÔÏó¡£
	// Parameters:
	//		[in] nPageNum - Ò³Âë£¬ÓÉ1¿ªÊ¼¡£
	// Returns:
	//		³É¹¦Ôò·µ»ØÖ¸¶¨Ò³ÂëµÄÒ³¶ÔÏó£¬Ê§°ÜÔò·µ»Ø¿Õ¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual IDKPPage* GetPage(DK_INT nPageNum) = 0;

    //-------------------------------------------
    // Summary:
    //		ÊÍ·ÅÒ³¶ÔÏó£¬µ÷ÓÃºóÒ³¶ÔÏóÖ¸Õë²»ÔÙ¿ÉÓÃ£¬ÔÙ´ÎÊ¹ÓÃÊ±±ØÐëµ÷ÓÃGetPage»ñÈ¡¶ÔÏó¡£
    // Parameters:
    //		[in] pPage - Ò³¶ÔÏóÖ¸Õë¡£
    //		[in] bAll -	ÊÇ·ñÊÍ·ÅËùÓÐÄÚÈÝ¡£
    // SDK Version:
    //		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
    //-------------------------------------------
    virtual DK_VOID ReleasePage(IDKPPage* pPage, DK_BOOL bAll = DK_FALSE) = 0;

    //-------------------------------------------
    //  Summary:
    //      ÉèÖÃÁ÷Ê½ÅÅ°æÄ£Ê½£¬Ö»¶ÔÁ÷Ê½Ò³ÓÐÐ§
    //  Parameters:
    //      [in] typeSetting            - ÅÅ°æÄ£Ê½¡£
    //  Return Value:
    //      Null
    //  Availability:
    //      ´ÓDKP 2.5.0¿ªÊ¼Ö§³Ö¡£
    //-------------------------------------------
    virtual DK_VOID SetTypeSetting(const DKTYPESETTING &typeSetting) = 0;

	//-------------------------------------------
	// Summary:
	//		»ñµÃÖ¸¶¨Á÷Î»ÖÃµÄÖØÅÅÒ³¶ÔÏó¡£
	// Parameters:
    //		[in] pos            -  Ö¸¶¨ÆðÊ¼Î»ÖÃ
    //                          pos.nChapterIndex ±íÊ¾Ò³Âë£¨ÆðÊ¼Ò³Îª1£©;
    //                          pos.nParaIndex ±íÊ¾Í¨¹ýµ÷ÓÃ IDKPPage º¯Êý GetPageTextContentStream »ñµÃµÄ PDKPTEXTINFONODE Á´±íÏÂ±ê;
    //                          pos.nElemIndex ±íÊ¾ PDKPTEXTINFONODE.DKPTEXTINFO.strContent ÏÂ±ê;
    //      [in] option         - Ñ¡Ïî£¬°üÀ¨Ò³Ãæ¾ØÐÎ£¬dpi£¬×ÖºÅËõ·ÅµÈ
    //      [in] posType        - Ò³Æ«ÒÆÀàÐÍ
    //      [in/out] ppPageEx   - Êä³öÒ³Ãæ¶ÔÏó
	// Returns:
	//		³É¹¦Ôò·µ»Ø DKR_OK
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_ReturnCode GetPageEx(const DK_FLOWPOSITION& pos, const DKP_REARRANGE_PARSER_OPTION& option, REARRANGE_PAGE_POSITION_TYPE posType, IDKPPageEx** ppPageEx) = 0;

    //-------------------------------------------
    // Summary:
    //		ÊÍ·ÅÖØÅÅÒ³¶ÔÏó£¬µ÷ÓÃºóÖØÅÅÒ³¶ÔÏóÖ¸Õë²»ÔÙ¿ÉÓÃ£¬ÔÙ´ÎÊ¹ÓÃÊ±±ØÐëµ÷ÓÃGetPageEx»ñÈ¡¶ÔÏó¡£
    // Parameters:
    //		[in] pPage - ÖØÅÅÒ³¶ÔÏóÖ¸Õë¡£
    //		[in] bAll -	ÊÇ·ñÊÍ·ÅËùÓÐÄÚÈÝ¡£
    // SDK Version:
    //		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
    //-------------------------------------------
    virtual DK_VOID ReleasePageEx(IDKPPageEx* pPage, DK_BOOL bAll = DK_FALSE) = 0;

	//-------------------------------------------
	// Summary:
	//		»ñµÃÄ¿Â¼¶ÔÏó¡£
	// Returns:
	//		³É¹¦Ôò·µ»ØÄ¿Â¼¶ÔÏó£¬Ê§°ÜÔò·µ»Ø¿Õ¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual IDKPOutline* GetOutline() = 0;

	//-------------------------------------------
	// Summary:
	//		ÉèÖÃÄ¬ÈÏ×ÖÌåÃû×Ö¡£
	// Parameters:
	//		[in] pszDefaultFontFaceName - ×ÖÌåÃû×Ö¡£
	//		[in] charset - ×ÖÌå±àÂë¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_VOID SetDefaultFontFaceName(const DK_WCHAR* pszDefaultFontFaceName, DK_CHARSET_TYPE charset) = 0;

	//-------------------------------------------
	// Summary:
	//		»ñÈ¡ÎÄµµµÄÔªÊý¾Ý¡£
	// Parameters:
	//		[out] pMetaData - ÔªÊý¾Ý,´«Èë¿Õ¼´¿É¡£
	// SDK Version:
	//		´ÓDKP 1.0¿ªÊ¼Ö§³Ö
	//-------------------------------------------
	virtual DK_BOOL GetDocMetaData(PDKPMETADATA& pMetaData) = 0;
	virtual DK_BOOL ReleaseMetaData() = 0;

    //-------------------------------------------
    // Summary:
    //		»ñÈ¡µ±Ç°ÎÄµµµÄÖØÅÅÄ£Ê½¡£
    // Parameters:
    //      ÖØÅÅÄ£Ê½ÓÉÄÚºËÅÐ¶Ï£¬ËùÓÐÒ³ÃæµÄÖØÅÅ¾ù²ÉÓÃÍ¬Ò»ÖÖÖØÅÅÄ£Ê½¡£
    // SDK Version:
    //		´ÓDKP 2.4.0¿ªÊ¼Ö§³Ö
    //-------------------------------------------
    virtual DKP_REARRANGE_MODE GetRearrangeMode() = 0;

public:
	virtual ~IDKPDoc() {}
};

//===========================================================================

#endif
