Make conversion between CPDF_Action and its dictionary explicit.
[pdfium.git] / core / include / fpdfdoc / fpdf_doc.h
index fc19441..dbcc7f4 100644 (file)
-// Copyright 2014 PDFium Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style license that can be\r
-// found in the LICENSE file.\r
\r
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
-\r
-#ifndef _FPDF_DOC_H_\r
-#define _FPDF_DOC_H_\r
-#ifndef _FPDF_PARSER_\r
-#include "../fpdfapi/fpdf_parser.h"\r
-#endif\r
-#ifndef _FPDF_RENDER_\r
-#include "../fpdfapi/fpdf_render.h"\r
-#endif\r
-class CPDF_Action;\r
-class CPDF_Annot;\r
-class CPDF_AnnotList;\r
-class CPDF_Bookmark;\r
-class CPDF_BookmarkTree;\r
-class CPDF_Dest;\r
-class CPDF_Link;\r
-class CPDF_LinkList;\r
-class CPDF_Metadata;\r
-class CPDF_NameTree;\r
-class CPDF_NumberTree;\r
-class CPDF_TextObject;\r
-class CPDF_ViewerPreferences;\r
-class CPDF_Page;\r
-class CPDF_RenderOptions;\r
-class CXML_Element;\r
-class CPDF_OCContext;\r
-class CPDF_DocJSActions;\r
-class CPDF_ActionFields;\r
-class CPDF_AAction;\r
-class CPDF_FileSpec;\r
-class CPDF_IconFit;\r
-class CPDF_DefaultAppearance;\r
-class CPDF_InterForm;\r
-class CPDF_FormField;\r
-class CPDF_FormNotify;\r
-class CPDF_FormControl;\r
-class CPDF_LWinParam;\r
-class CFieldTree;\r
-class CPDF_ApSettings;\r
-class CPDF_NameTree : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_NameTree(CPDF_Dictionary* pRoot)\r
-    {\r
-        m_pRoot = pRoot;\r
-    }\r
-\r
-    CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category);\r
-\r
-    CPDF_Object*               LookupValue(int nIndex, CFX_ByteString& csName) const;\r
-\r
-    CPDF_Object*               LookupValue(const CFX_ByteString& csName) const;\r
-\r
-    CPDF_Array*                        LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName);\r
-\r
-    int                                        GetIndex(const CFX_ByteString& csName) const;\r
-\r
-    int                                        GetCount() const;\r
-\r
-\r
-    CPDF_Dictionary*   GetRoot() const\r
-    {\r
-        return m_pRoot;\r
-    }\r
-\r
-protected:\r
-\r
-    CPDF_Dictionary*           m_pRoot;\r
-};\r
-class CPDF_BookmarkTree : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_BookmarkTree(CPDF_Document* pDoc)\r
-    {\r
-        m_pDocument = pDoc;\r
-    }\r
-public:\r
-\r
-\r
-\r
-    CPDF_Bookmark              GetFirstChild(CPDF_Bookmark parent);\r
-\r
-    CPDF_Bookmark              GetNextSibling(CPDF_Bookmark bookmark);\r
-\r
-\r
-    CPDF_Document*             GetDocument() const\r
-    {\r
-        return m_pDocument;\r
-    }\r
-protected:\r
-\r
-    CPDF_Document*             m_pDocument;\r
-};\r
-#define PDFBOOKMARK_ITALIC                     1\r
-#define PDFBOOKMARK_BOLD                       2\r
-class CPDF_Bookmark : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_Bookmark(CPDF_Dictionary* pDict = NULL)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary*() const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-\r
-\r
-    FX_DWORD                   GetColorRef();\r
-\r
-    FX_DWORD                   GetFontStyle();\r
-\r
-    CFX_WideString             GetTitle();\r
-\r
-\r
-\r
-\r
-    CPDF_Dest                  GetDest(CPDF_Document* pDocument);\r
-\r
-    CPDF_Action                        GetAction();\r
-\r
-\r
-    CPDF_Dictionary*   m_pDict;\r
-};\r
-#define PDFZOOM_XYZ                                    1\r
-#define PDFZOOM_FITPAGE                                2\r
-#define PDFZOOM_FITHORZ                                3\r
-#define PDFZOOM_FITVERT                                4\r
-#define PDFZOOM_FITRECT                                5\r
-#define PDFZOOM_FITBBOX                                6\r
-#define PDFZOOM_FITBHORZ                       7\r
-\r
-#define PDFZOOM_FITBVERT                       8\r
-class CPDF_Dest : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_Dest(CPDF_Object* pObj = NULL)\r
-    {\r
-        m_pObj = pObj;\r
-    }\r
-\r
-    operator CPDF_Object* () const\r
-    {\r
-        return m_pObj;\r
-    }\r
-\r
-    CFX_ByteString             GetRemoteName();\r
-\r
-    int                                        GetPageIndex(CPDF_Document* pDoc);\r
-\r
-    FX_DWORD                   GetPageObjNum();\r
-\r
-    int                                        GetZoomMode();\r
-\r
-    FX_FLOAT                   GetParam(int index);\r
-\r
-\r
-    CPDF_Object*               m_pObj;\r
-};\r
-class CPDF_OCContext : public CFX_Object, public IPDF_OCContext\r
-{\r
-public:\r
-\r
-    enum UsageType {\r
-        View = 0,\r
-        Design,\r
-        Print,\r
-        Export\r
-    };\r
-\r
-    CPDF_OCContext(CPDF_Document *pDoc, UsageType eUsageType = View);\r
-\r
-    virtual ~CPDF_OCContext();\r
-\r
-    CPDF_Document*     GetDocument() const\r
-    {\r
-        return m_pDocument;\r
-    }\r
-\r
-    UsageType          GetUsageType() const\r
-    {\r
-        return m_eUsageType;\r
-    }\r
-\r
-    FX_BOOL                    CheckOCGVisible(const CPDF_Dictionary *pOCGDict);\r
-\r
-    void                       ResetOCContext();\r
-protected:\r
-\r
-    FX_BOOL                    LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const;\r
-\r
-    FX_BOOL                    LoadOCGState(const CPDF_Dictionary *pOCGDict) const;\r
-\r
-    FX_BOOL                    GetOCGVisible(const CPDF_Dictionary *pOCGDict);\r
-\r
-    FX_BOOL                    GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel = 0);\r
-\r
-    FX_BOOL                    LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL bFromConfig);\r
-\r
-    CPDF_Document              *m_pDocument;\r
-\r
-    UsageType                  m_eUsageType;\r
-\r
-    CFX_MapPtrTemplate<const CPDF_Dictionary*, void*>  m_OCGStates;\r
-};\r
-class CPDF_LWinParam : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_LWinParam(CPDF_Dictionary* pDict)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary* () const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-    inline CFX_ByteString      GetFileName()\r
-    {\r
-        return m_pDict->GetString("F");\r
-    }\r
-\r
-\r
-    inline CFX_ByteString      GetDefaultDirectory()\r
-    {\r
-        return m_pDict->GetString("D");\r
-    }\r
-\r
-\r
-    inline CFX_ByteString      GetOperation()\r
-    {\r
-        return m_pDict->GetString("O");\r
-    }\r
-\r
-\r
-    inline CFX_ByteString      GetParameter()\r
-    {\r
-        return m_pDict->GetString("P");\r
-    }\r
-\r
-    CPDF_Dictionary*           m_pDict;\r
-};\r
-class CPDF_ActionFields : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_ActionFields(const CPDF_Action* pAction)\r
-    {\r
-        m_pAction = (CPDF_Action*)pAction;\r
-    }\r
-\r
-    operator CPDF_Action*() const\r
-    {\r
-        return m_pAction;\r
-    }\r
-\r
-    FX_DWORD                           GetFieldsCount() const;\r
-\r
-    void                                       GetAllFields(CFX_PtrArray& fieldObjects) const;\r
-\r
-    CPDF_Object*                       GetField(FX_DWORD iIndex) const;\r
-\r
-    CPDF_Action*                       m_pAction;\r
-};\r
-\r
-#define PDFNAMED_NEXTPAGE              1\r
-#define PDFNAMED_PREVPAGE              2\r
-#define PDFNAMED_FIRSTPAGE             3\r
-#define PDFNAMED_LASTPAGE              4\r
-#define PDFJS_MAXLENGTH                        64\r
-class CPDF_Action : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_Action(CPDF_Dictionary* pDict = NULL)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary* () const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-    enum ActionType {\r
-        Unknown = 0,\r
-        GoTo,\r
-        GoToR,\r
-        GoToE,\r
-        Launch,\r
-        Thread,\r
-        URI,\r
-        Sound,\r
-        Movie,\r
-        Hide,\r
-        Named,\r
-        SubmitForm,\r
-        ResetForm,\r
-        ImportData,\r
-        JavaScript,\r
-        SetOCGState,\r
-        Rendition,\r
-        Trans,\r
-        GoTo3DView\r
-    };\r
-\r
-    CFX_ByteString             GetTypeName() const\r
-    {\r
-        return m_pDict->GetString("S");\r
-    }\r
-\r
-    ActionType                 GetType() const;\r
-\r
-\r
-\r
-    CPDF_Dest                  GetDest(CPDF_Document* pDoc) const;\r
-\r
-\r
-\r
-\r
-\r
-    CFX_WideString             GetFilePath() const;\r
-\r
-\r
-\r
-\r
-    FX_BOOL                            GetNewWindow() const\r
-    {\r
-        return m_pDict->GetBoolean("NewWindow");\r
-    }\r
-\r
-\r
-\r
-\r
-    CPDF_LWinParam             GetWinParam() const;\r
-\r
-\r
-\r
-\r
-    CFX_ByteString             GetURI(CPDF_Document* pDoc) const;\r
-\r
-\r
-\r
-\r
-    FX_BOOL                            GetMouseMap() const\r
-    {\r
-        return m_pDict->GetBoolean("IsMap");\r
-    }\r
-\r
-\r
-\r
-\r
-    CPDF_ActionFields  GetWidgets() const\r
-    {\r
-        return this;\r
-    }\r
-\r
-\r
-\r
-\r
-    FX_BOOL                            GetHideStatus() const\r
-    {\r
-        return m_pDict->GetBoolean("H", TRUE);\r
-    }\r
-\r
-\r
-\r
-\r
-    CFX_ByteString             GetNamedAction() const\r
-    {\r
-        return m_pDict->GetString("N");\r
-    }\r
-\r
-\r
-\r
-\r
-    FX_DWORD                   GetFlags() const\r
-    {\r
-        return m_pDict->GetInteger("Flags");\r
-    }\r
-\r
-\r
-\r
-\r
-    CFX_WideString             GetJavaScript() const;\r
-\r
-\r
-\r
-\r
-    CPDF_Dictionary*   GetAnnot() const;\r
-\r
-\r
-\r
-\r
-    FX_INT32                   GetOperationType() const;\r
-\r
-\r
-\r
-\r
-    CPDF_Stream*               GetSoundStream() const\r
-    {\r
-        return m_pDict->GetStream("Sound");\r
-    }\r
-\r
-    FX_FLOAT                   GetVolume() const\r
-    {\r
-        return m_pDict->GetNumber("Volume");\r
-    }\r
-\r
-    FX_BOOL                            IsSynchronous() const\r
-    {\r
-        return m_pDict->GetBoolean("Synchronous");\r
-    }\r
-\r
-    FX_BOOL                            IsRepeat() const\r
-    {\r
-        return m_pDict->GetBoolean("Repeat");\r
-    }\r
-\r
-    FX_BOOL                            IsMixPlay() const\r
-    {\r
-        return m_pDict->GetBoolean("Mix");\r
-    }\r
-\r
-\r
-\r
-\r
-    FX_DWORD                   GetSubActionsCount() const;\r
-\r
-    CPDF_Action                        GetSubAction(FX_DWORD iIndex) const;\r
-\r
-\r
-    CPDF_Dictionary*   m_pDict;\r
-};\r
-class CPDF_AAction : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_AAction(CPDF_Dictionary* pDict = NULL)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary*()        const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-    enum AActionType {\r
-        CursorEnter = 0,\r
-        CursorExit,\r
-        ButtonDown,\r
-        ButtonUp,\r
-        GetFocus,\r
-        LoseFocus,\r
-        PageOpen,\r
-        PageClose,\r
-        PageVisible,\r
-        PageInvisible,\r
-        OpenPage,\r
-        ClosePage,\r
-        KeyStroke,\r
-        Format,\r
-        Validate,\r
-        Calculate,\r
-        CloseDocument,\r
-        SaveDocument,\r
-        DocumentSaved,\r
-        PrintDocument,\r
-        DocumentPrinted\r
-    };\r
-\r
-    FX_BOOL                            ActionExist(AActionType eType) const;\r
-\r
-    CPDF_Action                        GetAction(AActionType eType) const;\r
-\r
-    FX_POSITION                        GetStartPos() const;\r
-\r
-    CPDF_Action                        GetNextAction(FX_POSITION& pos, AActionType& eType) const;\r
-\r
-    CPDF_Dictionary*   m_pDict;\r
-};\r
-class CPDF_DocJSActions : public CFX_Object\r
-{\r
-public:\r
-    CPDF_DocJSActions(CPDF_Document* pDoc);\r
-\r
-\r
-    int                                        CountJSActions() const;\r
-\r
-    CPDF_Action                        GetJSAction(int index, CFX_ByteString& csName) const;\r
-\r
-    CPDF_Action                        GetJSAction(const CFX_ByteString& csName) const;\r
-\r
-    int                                        FindJSAction(const CFX_ByteString& csName) const;\r
-\r
-\r
-    CPDF_Document*             GetDocument() const\r
-    {\r
-        return m_pDocument;\r
-    }\r
-\r
-protected:\r
-\r
-    CPDF_Document*             m_pDocument;\r
-};\r
-class CPDF_FileSpec : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_FileSpec();\r
-\r
-    CPDF_FileSpec(CPDF_Object *pObj)\r
-    {\r
-        m_pObj = pObj;\r
-    }\r
-\r
-    operator CPDF_Object*() const\r
-    {\r
-        return m_pObj;\r
-    }\r
-\r
-    FX_BOOL                    IsURL() const;\r
-\r
-    FX_BOOL                    GetFileName(CFX_WideString &wsFileName) const;\r
-\r
-    CPDF_Stream*       GetFileStream() const;\r
-\r
-    void                       SetFileName(FX_WSTR wsFileName, FX_BOOL bURL = FALSE);\r
-protected:\r
-\r
-    CPDF_Object                *m_pObj;\r
-};\r
-class CPDF_LinkList : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_LinkList(CPDF_Document* pDoc)\r
-    {\r
-        m_pDocument = pDoc;\r
-    }\r
-\r
-    ~CPDF_LinkList();\r
-\r
-    CPDF_Link                  GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y);\r
-\r
-    int                                        CountLinks(CPDF_Page* pPage);\r
-\r
-    CPDF_Link                  GetLink(CPDF_Page* pPage, int index);\r
-\r
-    CPDF_Document*             GetDocument() const\r
-    {\r
-        return m_pDocument;\r
-    }\r
-protected:\r
-\r
-    CPDF_Document*             m_pDocument;\r
-\r
-    CFX_MapPtrToPtr            m_PageMap;\r
-\r
-    CFX_PtrArray*              GetPageLinks(CPDF_Page* pPage);\r
-\r
-    void                               LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList);\r
-};\r
-class CPDF_Link : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_Link(CPDF_Dictionary* pDict = NULL)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary*() const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-    CFX_FloatRect              GetRect();\r
-\r
-\r
-\r
-    CPDF_Dest                  GetDest(CPDF_Document* pDoc);\r
-\r
-    CPDF_Action                        GetAction();\r
-\r
-\r
-    CPDF_Dictionary*   m_pDict;\r
-};\r
-#define ANNOTFLAG_INVISIBLE                    1\r
-#define ANNOTFLAG_HIDDEN                       2\r
-#define ANNOTFLAG_PRINT                                4\r
-#define ANNOTFLAG_NOZOOM                       8\r
-#define ANNOTFLAG_NOROTATE                     0x10\r
-#define ANNOTFLAG_NOVIEW                       0x20\r
-#define ANNOTFLAG_READONLY                     0x40\r
-#define ANNOTFLAG_LOCKED                       0x80\r
-#define ANNOTFLAG_TOGGLENOVIEW         0x100\r
-class CPDF_Annot : public CFX_PrivateData, public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_Annot(CPDF_Dictionary* pDict);\r
-\r
-    ~CPDF_Annot();\r
-\r
-    CPDF_Dictionary*   m_pAnnotDict;\r
-\r
-    CFX_ByteString             GetSubType() const;\r
-\r
-    FX_DWORD                   GetFlags() const\r
-    {\r
-        return m_pAnnotDict->GetInteger("F");\r
-    }\r
-\r
-    void                               GetRect(CFX_FloatRect& rect) const;\r
-\r
-    enum AppearanceMode        {\r
-        Normal,\r
-        Rollover,\r
-        Down\r
-    };\r
-\r
-    FX_BOOL                            DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,\r
-                                       AppearanceMode mode, const CPDF_RenderOptions* pOptions);\r
-\r
-    FX_BOOL                            DrawInContext(const CPDF_Page* pPage, const CPDF_RenderContext* pContext,\r
-                                      const CFX_AffineMatrix* pUser2Device, AppearanceMode mode);\r
-\r
-    void                               ClearCachedAP();\r
-\r
-\r
-    void                               DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,\r
-                                   const CPDF_RenderOptions* pOptions);\r
-\r
-    CPDF_PageObject*   GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions);\r
-\r
-\r
-\r
-    int                                        CountIRTNotes();\r
-\r
-    CPDF_Annot*                        GetIRTNote(int index);\r
-\r
-\r
-    CPDF_Form*                 GetAPForm(const CPDF_Page* pPage, AppearanceMode mode);\r
-private:\r
-\r
-    CFX_MapPtrToPtr            m_APMap;\r
-protected:\r
-    friend class               CPDF_AnnotList;\r
-\r
-    CPDF_AnnotList*            m_pList;\r
-\r
-    CPDF_Reference*            NewAnnotRef();\r
-};\r
-class CPDF_AnnotList : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_AnnotList(CPDF_Page* pPage);\r
-\r
-    ~CPDF_AnnotList();\r
-\r
-    void       GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix* pUser2Device, CFX_Matrix &matrix) const;\r
-\r
-    void       GetAnnotRect(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix* pUser2Device, CPDF_Rect &rtAnnot) const;\r
-\r
-    void                               DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,\r
-                                      CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,\r
-                                      CPDF_RenderOptions* pOptions);\r
-\r
-    void                               DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext,\r
-                                      FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,\r
-                                      CPDF_RenderOptions* pOptions)\r
-    {\r
-        DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3 : 1, pOptions, NULL);\r
-    }\r
-\r
-    void                               DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext,\r
-                                      FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,\r
-                                      CPDF_RenderOptions* pOptions, FX_RECT *pClipRect)\r
-    {\r
-        DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3 : 1, pOptions, pClipRect);\r
-    }\r
-\r
-    void                               DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext,\r
-                                      FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_DWORD dwAnnotFlags,\r
-                                      CPDF_RenderOptions* pOptions, FX_RECT* pClipRect);\r
-\r
-\r
-\r
-    CPDF_Annot*                        GetAt(int index)\r
-    {\r
-        return (CPDF_Annot*)m_AnnotList.GetAt(index);\r
-    }\r
-\r
-    int                                        Count()\r
-    {\r
-        return m_AnnotList.GetSize();\r
-    }\r
-\r
-    int                                        GetIndex(CPDF_Annot* pAnnot);\r
-\r
-\r
-    CPDF_Document*             GetDocument() const\r
-    {\r
-        return m_pDocument;\r
-    }\r
-protected:\r
-\r
-    CFX_PtrArray               m_AnnotList;\r
-\r
-    CPDF_Dictionary*   m_pPageDict;\r
-\r
-    CPDF_Document*             m_pDocument;\r
-\r
-    CFX_PtrArray               m_Borders;\r
-\r
-    void                               DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,\r
-                                    CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix,\r
-                                    FX_BOOL bWidget, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect);\r
-    friend class               CPDF_Annot;\r
-};\r
-#define COLORTYPE_TRANSPARENT  0\r
-#define COLORTYPE_GRAY                 1\r
-#define COLORTYPE_RGB                  2\r
-#define COLORTYPE_CMYK                 3\r
-class CPDF_DefaultAppearance : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_DefaultAppearance(const CFX_ByteString& csDA = "")\r
-    {\r
-        m_csDA = csDA;\r
-    }\r
-\r
-    CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA)\r
-    {\r
-        m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;\r
-    }\r
-\r
-\r
-    operator CFX_ByteString() const\r
-    {\r
-        return m_csDA;\r
-    }\r
-\r
-    const CPDF_DefaultAppearance& operator =(const CFX_ByteString& csDA)\r
-    {\r
-        m_csDA = csDA;\r
-        return *this;\r
-    }\r
-\r
-    const CPDF_DefaultAppearance& operator =(const CPDF_DefaultAppearance& cDA)\r
-    {\r
-        m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;\r
-        return *this;\r
-    }\r
-\r
-\r
-\r
-    FX_BOOL                            HasFont();\r
-\r
-    CFX_ByteString             GetFontString();\r
-\r
-    void                               GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize);\r
-\r
-\r
-\r
-\r
-    FX_BOOL                            HasColor(FX_BOOL bStrokingOperation = FALSE);\r
-\r
-    CFX_ByteString             GetColorString(FX_BOOL bStrokingOperation = FALSE);\r
-\r
-    void                               GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL bStrokingOperation = FALSE);\r
-\r
-    void                               GetColor(FX_ARGB& color, int& iColorType, FX_BOOL bStrokingOperation = FALSE);\r
-\r
-\r
-\r
-\r
-    FX_BOOL                            HasTextMatrix();\r
-\r
-    CFX_ByteString             GetTextMatrixString();\r
-\r
-    CFX_AffineMatrix   GetTextMatrix();\r
-\r
-protected:\r
-\r
-    CFX_ByteString             m_csDA;\r
-};\r
-#define FIELDTYPE_UNKNOWN                      0\r
-#define FIELDTYPE_PUSHBUTTON           1\r
-#define FIELDTYPE_CHECKBOX                     2\r
-#define FIELDTYPE_RADIOBUTTON          3\r
-#define FIELDTYPE_COMBOBOX                     4\r
-#define FIELDTYPE_LISTBOX                      5\r
-#define FIELDTYPE_TEXTFIELD                    6\r
-#define FIELDTYPE_SIGNATURE                    7\r
-class CPDF_InterForm : public CFX_PrivateData, public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP);\r
-\r
-    ~CPDF_InterForm();\r
-\r
-\r
-\r
-    static void                                EnableUpdateAP(FX_BOOL bUpdateAP);\r
-\r
-    static FX_BOOL                     UpdatingAPEnabled();\r
-\r
-\r
-    static CFX_ByteString      GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen = 2, FX_LPCSTR csPrefix = "");\r
-\r
-\r
-\r
-    static CPDF_Font*          AddSystemDefaultFont(const CPDF_Document* pDocument);\r
-\r
-    static CPDF_Font*          AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet = 1);\r
-\r
-    static CPDF_Font*          AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet = 1);\r
-\r
-    static CPDF_Font*          AddStandardFont(const CPDF_Document* pDocument, CFX_ByteString csFontName);\r
-\r
-    static CFX_ByteString      GetNativeFont(FX_BYTE iCharSet, FX_LPVOID pLogFont = NULL);\r
-\r
-    static CFX_ByteString      GetNativeFont(FX_LPVOID pLogFont = NULL);\r
-\r
-    static FX_BYTE                     GetNativeCharSet();\r
-\r
-    static CPDF_Font*          AddNativeFont(FX_BYTE iCharSet, const CPDF_Document* pDocument);\r
-\r
-    static CPDF_Font*          AddNativeFont(const CPDF_Document* pDocument);\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    ValidateFieldName(CFX_WideString& csNewFieldName, int iType);\r
-\r
-    FX_BOOL                                    ValidateFieldName(const CPDF_FormField* pField, CFX_WideString& csNewFieldName);\r
-\r
-    FX_BOOL                                    ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName);\r
-\r
-\r
-\r
-\r
-    FX_DWORD                           CountFields(const CFX_WideString &csFieldName = L"");\r
-\r
-    CPDF_FormField*                    GetField(FX_DWORD index, const CFX_WideString &csFieldName = L"");\r
-\r
-    void                                       GetAllFieldNames(CFX_WideStringArray& allFieldNames);\r
-\r
-    FX_BOOL                                    IsValidFormField(const void* pField);\r
-\r
-    CPDF_FormField*                    GetFieldByDict(CPDF_Dictionary* pFieldDict) const;\r
-\r
-\r
-\r
-\r
-    FX_DWORD                           CountControls(CFX_WideString csFieldName = L"");\r
-\r
-    CPDF_FormControl*          GetControl(FX_DWORD index, CFX_WideString csFieldName = L"");\r
-\r
-    FX_BOOL                                    IsValidFormControl(const void* pControl);\r
-\r
-    int                                                CountPageControls(CPDF_Page* pPage) const;\r
-\r
-    CPDF_FormControl*          GetPageControl(CPDF_Page* pPage, int index) const;\r
-\r
-\r
-    CPDF_FormControl*          GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y) const;\r
-\r
-    CPDF_FormControl*          GetControlByDict(CPDF_Dictionary* pWidgetDict) const;\r
-\r
-\r
-\r
-\r
-    FX_DWORD                           CountInternalFields(const CFX_WideString& csFieldName = L"") const;\r
-\r
-    CPDF_Dictionary*           GetInternalField(FX_DWORD index, const CFX_WideString& csFieldName = L"") const;\r
-\r
-\r
-\r
-\r
-\r
-    CPDF_Document*                     GetDocument() const\r
-    {\r
-        return m_pDocument;\r
-    }\r
-\r
-    CPDF_Dictionary*           GetFormDict() const\r
-    {\r
-        return m_pFormDict;\r
-    }\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    NeedConstructAP();\r
-\r
-    void                                       NeedConstructAP(FX_BOOL bNeedAP);\r
-\r
-\r
-\r
-\r
-    int                                                CountFieldsInCalculationOrder();\r
-\r
-    CPDF_FormField*                    GetFieldInCalculationOrder(int index);\r
-\r
-    int                                                FindFieldInCalculationOrder(const CPDF_FormField* pField);\r
-\r
-\r
-\r
-\r
-    FX_DWORD                           CountFormFonts();\r
-\r
-    CPDF_Font*                         GetFormFont(FX_DWORD index, CFX_ByteString& csNameTag);\r
-\r
-    CPDF_Font*                         GetFormFont(CFX_ByteString csNameTag);\r
-\r
-    CPDF_Font*                         GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag);\r
-\r
-    CPDF_Font*                         GetNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag);\r
-\r
-    CPDF_Font*                         GetNativeFormFont(CFX_ByteString& csNameTag);\r
-\r
-    FX_BOOL                                    FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag);\r
-\r
-    FX_BOOL                                    FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag);\r
-\r
-    inline FX_BOOL                     FindFormFont(CFX_WideString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)\r
-    {\r
-        return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag);\r
-    }\r
-\r
-\r
-\r
-\r
-\r
-    void                                       AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag);\r
-\r
-    CPDF_Font*                         AddNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag);\r
-\r
-    CPDF_Font*                         AddNativeFormFont(CFX_ByteString& csNameTag);\r
-\r
-    void                                       RemoveFormFont(const CPDF_Font* pFont);\r
-\r
-    void                                       RemoveFormFont(CFX_ByteString csNameTag);\r
-\r
-\r
-\r
-\r
-    CPDF_DefaultAppearance     GetDefaultAppearance();\r
-\r
-    CPDF_Font*                         GetDefaultFormFont();\r
-\r
-\r
-\r
-    int                                                GetFormAlignment();\r
-\r
-\r
-\r
-\r
-    CPDF_FormField*                    CheckRequiredFields(const CFX_PtrArray *fields = NULL, FX_BOOL bIncludeOrExclude = TRUE) const;\r
-\r
-    CFDF_Document*                     ExportToFDF(FX_WSTR pdf_path, FX_BOOL bSimpleFileSpec = FALSE) const;\r
-\r
-    CFDF_Document*                     ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bSimpleFileSpec = FALSE) const;\r
-\r
-    FX_BOOL                                    ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE);\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    ResetForm(const CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bNotify = FALSE);\r
-\r
-    FX_BOOL                                    ResetForm(FX_BOOL bNotify = FALSE);\r
-\r
-    void                                       ReloadForm();\r
-\r
-    CPDF_FormNotify*           GetFormNotify() const\r
-    {\r
-        return m_pFormNotify;\r
-    }\r
-\r
-    void                                       SetFormNotify(const CPDF_FormNotify* pNotify);\r
-\r
-\r
-    int                                                GetPageWithWidget(int iCurPage, FX_BOOL bNext);\r
-\r
-\r
-\r
-    FX_BOOL                                    IsUpdated()\r
-    {\r
-        return m_bUpdated;\r
-    }\r
-\r
-    void                                       ClearUpdatedFlag()\r
-    {\r
-        m_bUpdated = FALSE;\r
-    }\r
-\r
-\r
-    FX_BOOL                                    HasXFAForm() const;\r
-\r
-    void                                       FixPageFields(const CPDF_Page* pPage);\r
-protected:\r
-\r
-    static FX_BOOL                     m_bUpdateAP;\r
-\r
-    void                                       LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0);\r
-\r
-    CPDF_Object*                       GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name);\r
-\r
-    CPDF_FormField*                    AddTerminalField(const CPDF_Dictionary* pFieldDict);\r
-\r
-    CPDF_FormControl*          AddControl(const CPDF_FormField* pField, const CPDF_Dictionary* pWidgetDict);\r
-\r
-    void                                       FDF_ImportField(CPDF_Dictionary* pField, const CFX_WideString& parent_name, FX_BOOL bNotify = FALSE, int nLevel = 0);\r
-\r
-    FX_BOOL                                    ValidateFieldName(CFX_WideString& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedControl);\r
-\r
-    int                                                CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2);\r
-\r
-    int                                                CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2);\r
-\r
-    CPDF_Document*                     m_pDocument;\r
-\r
-    FX_BOOL                                    m_bGenerateAP;\r
-\r
-    CPDF_Dictionary*           m_pFormDict;\r
-\r
-    CFX_MapPtrToPtr                    m_ControlMap;\r
-\r
-    CFieldTree *m_pFieldTree;\r
-\r
-    CFX_ByteString                     m_bsEncoding;\r
-\r
-    CPDF_FormNotify*           m_pFormNotify;\r
-\r
-    FX_BOOL                                    m_bUpdated;\r
-    friend class CPDF_FormControl;\r
-    friend class CPDF_FormField;\r
-};\r
-#define FORMFIELD_READONLY             0x01\r
-#define FORMFIELD_REQUIRED             0x02\r
-#define FORMFIELD_NOEXPORT             0x04\r
-#define FORMRADIO_NOTOGGLEOFF  0x100\r
-#define FORMRADIO_UNISON               0x200\r
-#define FORMTEXT_MULTILINE             0x100\r
-#define FORMTEXT_PASSWORD              0x200\r
-#define FORMTEXT_NOSCROLL              0x400\r
-#define FORMTEXT_COMB                  0x800\r
-#define FORMCOMBO_EDIT                 0x100\r
-#define FORMLIST_MULTISELECT   0x100\r
-class CPDF_FormField : public CFX_Object\r
-{\r
-public:\r
-\r
-    enum Type {\r
-        Unknown,\r
-        PushButton,\r
-        RadioButton,\r
-        CheckBox,\r
-        Text,\r
-        RichText,\r
-        File,\r
-        ListBox,\r
-        ComboBox,\r
-        Sign\r
-    };\r
-\r
-    CFX_WideString                     GetFullName();\r
-\r
-    Type                                       GetType()\r
-    {\r
-        return m_Type;\r
-    }\r
-\r
-    FX_DWORD                           GetFlags()\r
-    {\r
-        return m_Flags;\r
-    }\r
-\r
-    CPDF_InterForm*                    GetInterForm() const\r
-    {\r
-        return m_pForm;\r
-    }\r
-\r
-    CPDF_Dictionary*           GetFieldDict() const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-    void                                       SetFieldDict(CPDF_Dictionary* pDict)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    FX_BOOL                                    ResetField(FX_BOOL bNotify = FALSE);\r
-\r
-\r
-\r
-    int                                                CountControls()\r
-    {\r
-        return m_ControlList.GetSize();\r
-    }\r
-\r
-    CPDF_FormControl*          GetControl(int index)\r
-    {\r
-        return (CPDF_FormControl*)m_ControlList.GetAt(index);\r
-    }\r
-\r
-    int                                                GetControlIndex(const CPDF_FormControl* pControl);\r
-\r
-\r
-\r
-\r
-    int                                                GetFieldType();\r
-\r
-\r
-\r
-\r
-    CPDF_AAction                       GetAdditionalAction();\r
-\r
-\r
-\r
-\r
-    CFX_WideString                     GetAlternateName();\r
-\r
-\r
-\r
-\r
-    CFX_WideString                     GetMappingName();\r
-\r
-\r
-\r
-\r
-    FX_DWORD                           GetFieldFlags();\r
-\r
-\r
-\r
-\r
-    CFX_ByteString                     GetDefaultStyle();\r
-\r
-\r
-\r
-\r
-    CFX_WideString                     GetRichTextString();\r
-\r
-\r
-\r
-    CFX_WideString                     GetValue();\r
-\r
-    CFX_WideString                     GetDefaultValue();\r
-\r
-    FX_BOOL                                    SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE);\r
-\r
-\r
-\r
-\r
-\r
-    int                                                GetMaxLen();\r
-\r
-\r
-\r
-\r
-    int                                                CountSelectedItems();\r
-\r
-    int                                                GetSelectedIndex(int index);\r
-\r
-    FX_BOOL                                    ClearSelection(FX_BOOL bNotify = FALSE);\r
-\r
-    FX_BOOL                                    IsItemSelected(int index);\r
-\r
-    FX_BOOL                                    SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify = FALSE);\r
-\r
-    FX_BOOL                                    IsItemDefaultSelected(int index);\r
-\r
-    int                                                GetDefaultSelectedItem();\r
-\r
-\r
-\r
-\r
-    int                                                CountOptions();\r
-\r
-    CFX_WideString                     GetOptionLabel(int index);\r
-\r
-    CFX_WideString                     GetOptionValue(int index);\r
-\r
-    int                                                FindOption(CFX_WideString csOptLabel);\r
-\r
-    int                                                FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex = 0);\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOOL bNotify = FALSE);\r
-\r
-\r
-\r
-\r
-    int                                                GetTopVisibleIndex();\r
-\r
-\r
-\r
-\r
-    int                                                CountSelectedOptions();\r
-\r
-    int                                                GetSelectedOptionIndex(int index);\r
-\r
-    FX_BOOL                                    IsOptionSelected(int iOptIndex);\r
-\r
-    FX_BOOL                                    SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL bNotify = FALSE);\r
-\r
-    FX_BOOL                                    ClearSelectedOptions(FX_BOOL bNotify = FALSE);\r
-\r
-\r
-\r
-\r
-    FX_FLOAT                           GetFontSize()\r
-    {\r
-        return m_FontSize;\r
-    }\r
-\r
-    CPDF_Font*                         GetFont()\r
-    {\r
-        return m_pFont;\r
-    }\r
-\r
-protected:\r
-\r
-    CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);\r
-\r
-    ~CPDF_FormField();\r
-\r
-    CPDF_FormField::Type       m_Type;\r
-\r
-    FX_DWORD                           m_Flags;\r
-\r
-    CPDF_InterForm*                    m_pForm;\r
-\r
-    CPDF_Dictionary*           m_pDict;\r
-\r
-    CFX_PtrArray                       m_ControlList;\r
-    friend class                       CPDF_InterForm;\r
-    friend class                       CPDF_FormControl;\r
-\r
-\r
-\r
-    CFX_WideString                     GetValue(FX_BOOL bDefault);\r
-\r
-    FX_BOOL                                    SetValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify);\r
-\r
-\r
-    void                                       SyncFieldFlags();\r
-\r
-    int                                                FindListSel(CPDF_String* str);\r
-\r
-    CFX_WideString                     GetOptionText(int index, int sub_index);\r
-\r
-    void                                       LoadDA();\r
-\r
-    void                                       UpdateAP(CPDF_FormControl* pControl);\r
-\r
-\r
-\r
-    CFX_WideString                     GetCheckValue(FX_BOOL bDefault);\r
-\r
-    FX_BOOL                                    SetCheckValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify);\r
-\r
-\r
-    FX_FLOAT                           m_FontSize;\r
-\r
-    CPDF_Font*                         m_pFont;\r
-};\r
-CPDF_Object*   FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name, int nLevel = 0);\r
-class CPDF_IconFit : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_IconFit(CPDF_Dictionary* pDict = NULL)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary*() const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-\r
-\r
-\r
-    enum ScaleMethod {\r
-        Always = 0,\r
-        Bigger,\r
-        Smaller,\r
-        Never\r
-    };\r
-\r
-    ScaleMethod                                GetScaleMethod();\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    IsProportionalScale();\r
-\r
-\r
-\r
-\r
-    void                                       GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    GetFittingBounds();\r
-\r
-\r
-    CPDF_Dictionary*           m_pDict;\r
-};\r
-\r
-#define TEXTPOS_CAPTION                0\r
-#define TEXTPOS_ICON           1\r
-#define TEXTPOS_BELOW          2\r
-#define TEXTPOS_ABOVE          3\r
-#define TEXTPOS_RIGHT          4\r
-#define TEXTPOS_LEFT           5\r
-#define TEXTPOS_OVERLAID       6\r
-class CPDF_FormControl : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_FormField::Type       GetType()\r
-    {\r
-        return m_pField->GetType();\r
-    }\r
-\r
-    CPDF_InterForm*                    GetInterForm() const\r
-    {\r
-        return m_pForm;\r
-    }\r
-\r
-    CPDF_FormField*                    GetField() const\r
-    {\r
-        return m_pField;\r
-    }\r
-\r
-    CPDF_Dictionary*           GetWidget() const\r
-    {\r
-        return m_pWidgetDict;\r
-    }\r
-\r
-    CFX_FloatRect                      GetRect();\r
-\r
-    void                                       DrawControl(CFX_RenderDevice* pDevice, CFX_AffineMatrix* pMatrix,\r
-                                        CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions = NULL);\r
-\r
-\r
-\r
-    CFX_ByteString                     GetCheckedAPState();\r
-\r
-    CFX_WideString                     GetExportValue();\r
-\r
-    FX_BOOL                                    IsChecked();\r
-\r
-    FX_BOOL                                    IsDefaultChecked();\r
-\r
-\r
-\r
-\r
-    enum HighlightingMode      {\r
-        None = 0,\r
-        Invert,\r
-        Outline,\r
-        Push,\r
-        Toggle\r
-    };\r
-\r
-    HighlightingMode           GetHighlightingMode();\r
-\r
-\r
-\r
-\r
-    FX_BOOL                                    HasMKEntry(CFX_ByteString csEntry);\r
-\r
-\r
-\r
-\r
-    int                                                GetRotation();\r
-\r
-\r
-\r
-\r
-    inline FX_ARGB                     GetBorderColor(int& iColorType)\r
-    {\r
-        return GetColor(iColorType, "BC");\r
-    }\r
-\r
-    inline FX_FLOAT                    GetOriginalBorderColor(int index)\r
-    {\r
-        return GetOriginalColor(index, "BC");\r
-    }\r
-\r
-    inline void                                GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4])\r
-    {\r
-        GetOriginalColor(iColorType, fc, "BC");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline FX_ARGB                     GetBackgroundColor(int& iColorType)\r
-    {\r
-        return GetColor(iColorType, "BG");\r
-    }\r
-\r
-    inline FX_FLOAT                    GetOriginalBackgroundColor(int index)\r
-    {\r
-        return GetOriginalColor(index, "BG");\r
-    }\r
-\r
-    inline void                                GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4])\r
-    {\r
-        GetOriginalColor(iColorType, fc, "BG");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CFX_WideString      GetNormalCaption()\r
-    {\r
-        return GetCaption("CA");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CFX_WideString      GetRolloverCaption()\r
-    {\r
-        return GetCaption("RC");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CFX_WideString      GetDownCaption()\r
-    {\r
-        return GetCaption("AC");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CPDF_Stream*                GetNormalIcon()\r
-    {\r
-        return GetIcon("I");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CPDF_Stream*                GetRolloverIcon()\r
-    {\r
-        return GetIcon("RI");\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CPDF_Stream*                GetDownIcon()\r
-    {\r
-        return GetIcon("IX");\r
-    }\r
-\r
-\r
-\r
-\r
-    CPDF_IconFit                       GetIconFit();\r
-\r
-\r
-\r
-\r
-    int                                                GetTextPosition();\r
-\r
-\r
-\r
-\r
-    CPDF_Action                                GetAction();\r
-\r
-\r
-\r
-\r
-    CPDF_AAction                       GetAdditionalAction();\r
-\r
-\r
-\r
-\r
-    CPDF_DefaultAppearance     GetDefaultAppearance();\r
-\r
-    CPDF_Font*                         GetDefaultControlFont();\r
-\r
-\r
-\r
-\r
-    int                                                GetControlAlignment();\r
-\r
-protected:\r
-\r
-    CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict);\r
-\r
-    CFX_ByteString                     GetOnStateName();\r
-\r
-    void                                       SetOnStateName(const CFX_ByteString& csOn);\r
-\r
-    void                                       CheckControl(FX_BOOL bChecked);\r
-\r
-    FX_ARGB                                    GetColor(int& iColorType, CFX_ByteString csEntry);\r
-\r
-    FX_FLOAT                           GetOriginalColor(int index, CFX_ByteString csEntry);\r
-\r
-    void                                       GetOriginalColor(int& iColorType, FX_FLOAT fc[4], CFX_ByteString csEntry);\r
-\r
-    CFX_WideString                     GetCaption(CFX_ByteString csEntry);\r
-\r
-    CPDF_Stream*                       GetIcon(CFX_ByteString csEntry);\r
-\r
-    CPDF_ApSettings                    GetMK(FX_BOOL bCreate);\r
-\r
-    CPDF_InterForm*                    m_pForm;\r
-\r
-    CPDF_FormField*                    m_pField;\r
-\r
-    CPDF_Dictionary*           m_pWidgetDict;\r
-    friend class                       CPDF_InterForm;\r
-    friend class                       CPDF_FormField;\r
-};\r
-class CPDF_FormNotify : public CFX_Object\r
-{\r
-public:\r
-\r
-    virtual ~CPDF_FormNotify() {}\r
-\r
-    virtual int                BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                AfterValueChange(const CPDF_FormField* pField)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                AfterSelectionChange(const CPDF_FormField* pField)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                BeforeFormReset(const CPDF_InterForm* pForm)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                AfterFormReset(const CPDF_InterForm* pForm)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                BeforeFormImportData(const CPDF_InterForm* pForm)\r
-    {\r
-        return 0;\r
-    }\r
-\r
-    virtual int                AfterFormImportData(const CPDF_InterForm* pForm)\r
-    {\r
-        return 0;\r
-    }\r
-};\r
-FX_BOOL                FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);\r
-class CPDF_PageLabel : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_PageLabel(CPDF_Document* pDocument)\r
-    {\r
-        m_pDocument = pDocument;\r
-    }\r
-\r
-\r
-    CFX_WideString                                     GetLabel(int nPage) const;\r
-\r
-    FX_INT32                                           GetPageByLabel(FX_BSTR bsLabel) const;\r
-\r
-\r
-    FX_INT32                                           GetPageByLabel(FX_WSTR wsLabel) const;\r
-\r
-protected:\r
-    CPDF_Document*                                     m_pDocument;\r
-};\r
-class CPDF_Metadata\r
-{\r
-public:\r
-\r
-    CPDF_Metadata();\r
-\r
-\r
-    ~CPDF_Metadata();\r
-\r
-    void                               LoadDoc(CPDF_Document *pDoc);\r
-\r
-\r
-    FX_INT32                   GetString(FX_BSTR bsItem, CFX_WideString &wsStr);\r
-\r
-    CXML_Element*              GetRoot() const;\r
-\r
-    CXML_Element*              GetRDF() const;\r
-\r
-protected:\r
-    FX_LPVOID  m_pData;\r
-};\r
-class CPDF_ViewerPreferences\r
-{\r
-public:\r
-\r
-    CPDF_ViewerPreferences(CPDF_Document *pDoc);\r
-\r
-\r
-    ~CPDF_ViewerPreferences();\r
-\r
-\r
-    FX_BOOL IsDirectionR2L() const;\r
-\r
-    FX_BOOL PrintScaling() const;\r
-\r
-\r
-protected:\r
-    CPDF_Document*     m_pDoc;\r
-};\r
-class CPDF_ApSettings : public CFX_Object\r
-{\r
-public:\r
-\r
-    CPDF_ApSettings(CPDF_Dictionary* pDict = NULL)\r
-    {\r
-        m_pDict = pDict;\r
-    }\r
-\r
-    operator CPDF_Dictionary* () const\r
-    {\r
-        return m_pDict;\r
-    }\r
-\r
-    FX_BOOL                                    HasMKEntry(FX_BSTR csEntry);\r
-\r
-\r
-\r
-    int                                                GetRotation();\r
-\r
-\r
-\r
-\r
-    inline FX_ARGB                     GetBorderColor(int& iColorType)\r
-    {\r
-        return GetColor(iColorType, FX_BSTRC("BC"));\r
-    }\r
-\r
-    inline FX_FLOAT                    GetOriginalBorderColor(int index)\r
-    {\r
-        return GetOriginalColor(index, FX_BSTRC("BC"));\r
-    }\r
-\r
-    inline void                                GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4])\r
-    {\r
-        GetOriginalColor(iColorType, fc, FX_BSTRC("BC"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline FX_ARGB                     GetBackgroundColor(int& iColorType)\r
-    {\r
-        return GetColor(iColorType, FX_BSTRC("BG"));\r
-    }\r
-\r
-    inline FX_FLOAT                    GetOriginalBackgroundColor(int index)\r
-    {\r
-        return GetOriginalColor(index, FX_BSTRC("BG"));\r
-    }\r
-\r
-    inline void                                GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4])\r
-    {\r
-        GetOriginalColor(iColorType, fc, FX_BSTRC("BG"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CFX_WideString      GetNormalCaption()\r
-    {\r
-        return GetCaption(FX_BSTRC("CA"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CFX_WideString      GetRolloverCaption()\r
-    {\r
-        return GetCaption(FX_BSTRC("RC"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CFX_WideString      GetDownCaption()\r
-    {\r
-        return GetCaption(FX_BSTRC("AC"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CPDF_Stream*                GetNormalIcon()\r
-    {\r
-        return GetIcon(FX_BSTRC("I"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CPDF_Stream*                GetRolloverIcon()\r
-    {\r
-        return GetIcon(FX_BSTRC("RI"));\r
-    }\r
-\r
-\r
-\r
-\r
-    inline CPDF_Stream*                GetDownIcon()\r
-    {\r
-        return GetIcon(FX_BSTRC("IX"));\r
-    }\r
-\r
-\r
-\r
-\r
-    CPDF_IconFit                       GetIconFit();\r
-\r
-\r
-\r
-\r
-    int                                                GetTextPosition();\r
-\r
-    CPDF_Dictionary*           m_pDict;\r
-protected:\r
-\r
-    FX_ARGB                                    GetColor(int& iColorType, FX_BSTR csEntry);\r
-\r
-    FX_FLOAT                           GetOriginalColor(int index, FX_BSTR csEntry);\r
-\r
-    void                                       GetOriginalColor(int& iColorType, FX_FLOAT fc[4], FX_BSTR csEntry);\r
-\r
-    CFX_WideString                     GetCaption(FX_BSTR csEntry);\r
-\r
-    CPDF_Stream*                       GetIcon(FX_BSTR csEntry);\r
-    friend class                       CPDF_FormControl;\r
-};\r
-#endif\r
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef _FPDF_DOC_H_
+#define _FPDF_DOC_H_
+#ifndef _FPDF_PARSER_
+#include "../fpdfapi/fpdf_parser.h"
+#endif
+#ifndef _FPDF_RENDER_
+#include "../fpdfapi/fpdf_render.h"
+#endif
+class CPDF_Action;
+class CPDF_Annot;
+class CPDF_AnnotList;
+class CPDF_Bookmark;
+class CPDF_BookmarkTree;
+class CPDF_Dest;
+class CPDF_Link;
+class CPDF_LinkList;
+class CPDF_Metadata;
+class CPDF_NameTree;
+class CPDF_NumberTree;
+class CPDF_TextObject;
+class CPDF_ViewerPreferences;
+class CPDF_Page;
+class CPDF_RenderOptions;
+class CXML_Element;
+class CPDF_OCContext;
+class CPDF_DocJSActions;
+class CPDF_ActionFields;
+class CPDF_AAction;
+class CPDF_FileSpec;
+class CPDF_IconFit;
+class CPDF_DefaultAppearance;
+class CPDF_InterForm;
+class CPDF_FormField;
+class CPDF_FormNotify;
+class CPDF_FormControl;
+class CPDF_LWinParam;
+class CFieldTree;
+class CPDF_ApSettings;
+class CPDF_NameTree : public CFX_Object
+{
+public:
+
+    CPDF_NameTree(CPDF_Dictionary* pRoot)
+    {
+        m_pRoot = pRoot;
+    }
+
+    CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category);
+
+    CPDF_Object*               LookupValue(int nIndex, CFX_ByteString& csName) const;
+
+    CPDF_Object*               LookupValue(const CFX_ByteString& csName) const;
+
+    CPDF_Array*                        LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName);
+
+    int                                        GetIndex(const CFX_ByteString& csName) const;
+
+    int                                        GetCount() const;
+
+
+    CPDF_Dictionary*   GetRoot() const
+    {
+        return m_pRoot;
+    }
+
+protected:
+
+    CPDF_Dictionary*           m_pRoot;
+};
+class CPDF_BookmarkTree : public CFX_Object
+{
+public:
+    CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
+
+    CPDF_Bookmark              GetFirstChild(const CPDF_Bookmark& parent) const;
+
+    CPDF_Bookmark              GetNextSibling(const CPDF_Bookmark& bookmark) const;
+
+    CPDF_Document*             GetDocument() const { return m_pDocument; }
+
+protected:
+    CPDF_Document*             m_pDocument;
+};
+#define PDFBOOKMARK_ITALIC                     1
+#define PDFBOOKMARK_BOLD                       2
+class CPDF_Bookmark : public CFX_Object
+{
+public:
+
+    CPDF_Bookmark() : m_pDict(NULL) {}
+
+    explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
+
+    CPDF_Dictionary* GetDict() const { return m_pDict; }
+
+    operator bool() const { return m_pDict != NULL; }
+
+    FX_DWORD                   GetColorRef() const;
+
+    FX_DWORD                   GetFontStyle() const;
+
+    CFX_WideString             GetTitle() const;
+
+    CPDF_Dest                  GetDest(CPDF_Document* pDocument) const;
+
+    CPDF_Action                        GetAction() const;
+
+    CPDF_Dictionary*   m_pDict;
+};
+#define PDFZOOM_XYZ                                    1
+#define PDFZOOM_FITPAGE                                2
+#define PDFZOOM_FITHORZ                                3
+#define PDFZOOM_FITVERT                                4
+#define PDFZOOM_FITRECT                                5
+#define PDFZOOM_FITBBOX                                6
+#define PDFZOOM_FITBHORZ                       7
+#define PDFZOOM_FITBVERT                       8
+class CPDF_Dest : public CFX_Object
+{
+public:
+
+    CPDF_Dest(CPDF_Object* pObj = NULL)
+    {
+        m_pObj = pObj;
+    }
+
+    operator CPDF_Object* () const
+    {
+        return m_pObj;
+    }
+
+    CFX_ByteString             GetRemoteName();
+
+    int                                        GetPageIndex(CPDF_Document* pDoc);
+
+    FX_DWORD                   GetPageObjNum();
+
+    int                                        GetZoomMode();
+
+    FX_FLOAT                   GetParam(int index);
+
+
+    CPDF_Object*               m_pObj;
+};
+class CPDF_OCContext : public CFX_Object, public IPDF_OCContext
+{
+public:
+
+    enum UsageType {
+        View = 0,
+        Design,
+        Print,
+        Export
+    };
+
+    CPDF_OCContext(CPDF_Document *pDoc, UsageType eUsageType = View);
+
+    virtual ~CPDF_OCContext();
+
+    CPDF_Document*     GetDocument() const
+    {
+        return m_pDocument;
+    }
+
+    UsageType          GetUsageType() const
+    {
+        return m_eUsageType;
+    }
+
+    FX_BOOL                    CheckOCGVisible(const CPDF_Dictionary *pOCGDict);
+
+    void                       ResetOCContext();
+protected:
+
+    FX_BOOL                    LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const;
+
+    FX_BOOL                    LoadOCGState(const CPDF_Dictionary *pOCGDict) const;
+
+    FX_BOOL                    GetOCGVisible(const CPDF_Dictionary *pOCGDict);
+
+    FX_BOOL                    GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel = 0);
+
+    FX_BOOL                    LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL bFromConfig);
+
+    CPDF_Document              *m_pDocument;
+
+    UsageType                  m_eUsageType;
+
+    CFX_MapPtrTemplate<const CPDF_Dictionary*, void*>  m_OCGStates;
+};
+class CPDF_LWinParam : public CFX_Object
+{
+public:
+
+    CPDF_LWinParam(CPDF_Dictionary* pDict)
+    {
+        m_pDict = pDict;
+    }
+
+    operator CPDF_Dictionary* () const
+    {
+        return m_pDict;
+    }
+
+    inline CFX_ByteString      GetFileName()
+    {
+        return m_pDict->GetString("F");
+    }
+
+
+    inline CFX_ByteString      GetDefaultDirectory()
+    {
+        return m_pDict->GetString("D");
+    }
+
+
+    inline CFX_ByteString      GetOperation()
+    {
+        return m_pDict->GetString("O");
+    }
+
+
+    inline CFX_ByteString      GetParameter()
+    {
+        return m_pDict->GetString("P");
+    }
+
+    CPDF_Dictionary*           m_pDict;
+};
+class CPDF_ActionFields : public CFX_Object
+{
+public:
+
+    CPDF_ActionFields(const CPDF_Action* pAction)
+    {
+        m_pAction = (CPDF_Action*)pAction;
+    }
+
+    operator CPDF_Action*() const
+    {
+        return m_pAction;
+    }
+
+    FX_DWORD                           GetFieldsCount() const;
+
+    void                                       GetAllFields(CFX_PtrArray& fieldObjects) const;
+
+    CPDF_Object*                       GetField(FX_DWORD iIndex) const;
+
+    CPDF_Action*                       m_pAction;
+};
+
+#define PDFNAMED_NEXTPAGE              1
+#define PDFNAMED_PREVPAGE              2
+#define PDFNAMED_FIRSTPAGE             3
+#define PDFNAMED_LASTPAGE              4
+#define PDFJS_MAXLENGTH                        64
+class CPDF_Action : public CFX_Object
+{
+public:
+    enum ActionType {
+        Unknown = 0,
+        GoTo,
+        GoToR,
+        GoToE,
+        Launch,
+        Thread,
+        URI,
+        Sound,
+        Movie,
+        Hide,
+        Named,
+        SubmitForm,
+        ResetForm,
+        ImportData,
+        JavaScript,
+        SetOCGState,
+        Rendition,
+        Trans,
+        GoTo3DView
+    };
+
+    CPDF_Action() : m_pDict(nullptr) { }
+    explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) { }
+
+    operator bool () const { return m_pDict != NULL; }
+
+    CPDF_Dictionary* GetDict() const { return m_pDict; }
+
+    CFX_ByteString             GetTypeName() const
+    {
+        return m_pDict->GetString("S");
+    }
+
+    ActionType                 GetType() const;
+
+
+
+    CPDF_Dest                  GetDest(CPDF_Document* pDoc) const;
+
+
+
+
+
+    CFX_WideString             GetFilePath() const;
+
+
+
+
+    FX_BOOL                            GetNewWindow() const
+    {
+        return m_pDict->GetBoolean("NewWindow");
+    }
+
+
+
+
+    CPDF_LWinParam             GetWinParam() const;
+
+
+
+
+    CFX_ByteString             GetURI(CPDF_Document* pDoc) const;
+
+
+
+
+    FX_BOOL                            GetMouseMap() const
+    {
+        return m_pDict->GetBoolean("IsMap");
+    }
+
+
+
+
+    CPDF_ActionFields  GetWidgets() const
+    {
+        return this;
+    }
+
+
+
+
+    FX_BOOL                            GetHideStatus() const
+    {
+        return m_pDict->GetBoolean("H", TRUE);
+    }
+
+
+
+
+    CFX_ByteString             GetNamedAction() const
+    {
+        return m_pDict->GetString("N");
+    }
+
+
+
+
+    FX_DWORD                   GetFlags() const
+    {
+        return m_pDict->GetInteger("Flags");
+    }
+
+
+
+
+    CFX_WideString             GetJavaScript() const;
+
+
+
+
+    CPDF_Dictionary*   GetAnnot() const;
+
+
+
+
+    FX_INT32                   GetOperationType() const;
+
+
+
+
+    CPDF_Stream*               GetSoundStream() const
+    {
+        return m_pDict->GetStream("Sound");
+    }
+
+    FX_FLOAT                   GetVolume() const
+    {
+        return m_pDict->GetNumber("Volume");
+    }
+
+    FX_BOOL                            IsSynchronous() const
+    {
+        return m_pDict->GetBoolean("Synchronous");
+    }
+
+    FX_BOOL                            IsRepeat() const
+    {
+        return m_pDict->GetBoolean("Repeat");
+    }
+
+    FX_BOOL                            IsMixPlay() const
+    {
+        return m_pDict->GetBoolean("Mix");
+    }
+
+
+
+
+    FX_DWORD                   GetSubActionsCount() const;
+
+    CPDF_Action                        GetSubAction(FX_DWORD iIndex) const;
+
+protected:
+    CPDF_Dictionary*   m_pDict;
+};
+class CPDF_AAction : public CFX_Object
+{
+public:
+
+    CPDF_AAction(CPDF_Dictionary* pDict = NULL)
+    {
+        m_pDict = pDict;
+    }
+
+    operator CPDF_Dictionary*()        const
+    {
+        return m_pDict;
+    }
+
+    enum AActionType {
+        CursorEnter = 0,
+        CursorExit,
+        ButtonDown,
+        ButtonUp,
+        GetFocus,
+        LoseFocus,
+        PageOpen,
+        PageClose,
+        PageVisible,
+        PageInvisible,
+        OpenPage,
+        ClosePage,
+        KeyStroke,
+        Format,
+        Validate,
+        Calculate,
+        CloseDocument,
+        SaveDocument,
+        DocumentSaved,
+        PrintDocument,
+        DocumentPrinted
+    };
+
+    FX_BOOL                            ActionExist(AActionType eType) const;
+
+    CPDF_Action                        GetAction(AActionType eType) const;
+
+    FX_POSITION                        GetStartPos() const;
+
+    CPDF_Action                        GetNextAction(FX_POSITION& pos, AActionType& eType) const;
+
+    CPDF_Dictionary*   m_pDict;
+};
+class CPDF_DocJSActions : public CFX_Object
+{
+public:
+    CPDF_DocJSActions(CPDF_Document* pDoc);
+
+
+    int                                        CountJSActions() const;
+
+    CPDF_Action                        GetJSAction(int index, CFX_ByteString& csName) const;
+
+    CPDF_Action                        GetJSAction(const CFX_ByteString& csName) const;
+
+    int                                        FindJSAction(const CFX_ByteString& csName) const;
+
+
+    CPDF_Document*             GetDocument() const
+    {
+        return m_pDocument;
+    }
+
+protected:
+
+    CPDF_Document*             m_pDocument;
+};
+class CPDF_FileSpec : public CFX_Object
+{
+public:
+
+    CPDF_FileSpec();
+
+    CPDF_FileSpec(CPDF_Object *pObj)
+    {
+        m_pObj = pObj;
+    }
+
+    operator CPDF_Object*() const
+    {
+        return m_pObj;
+    }
+
+    FX_BOOL                    IsURL() const;
+
+    FX_BOOL                    GetFileName(CFX_WideString &wsFileName) const;
+
+    CPDF_Stream*       GetFileStream() const;
+
+    void                       SetFileName(FX_WSTR wsFileName, FX_BOOL bURL = FALSE);
+protected:
+
+    CPDF_Object                *m_pObj;
+};
+class CPDF_LinkList : public CFX_Object
+{
+public:
+
+    CPDF_LinkList(CPDF_Document* pDoc)
+    {
+        m_pDocument = pDoc;
+    }
+
+    ~CPDF_LinkList();
+
+    CPDF_Link                  GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y);
+
+    int                                        CountLinks(CPDF_Page* pPage);
+
+    CPDF_Link                  GetLink(CPDF_Page* pPage, int index);
+
+    CPDF_Document*             GetDocument() const
+    {
+        return m_pDocument;
+    }
+protected:
+
+    CPDF_Document*             m_pDocument;
+
+    CFX_MapPtrToPtr            m_PageMap;
+
+    CFX_PtrArray*              GetPageLinks(CPDF_Page* pPage);
+
+    void                               LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList);
+};
+class CPDF_Link : public CFX_Object
+{
+public:
+
+    CPDF_Link(CPDF_Dictionary* pDict = NULL)
+    {
+        m_pDict = pDict;
+    }
+
+    operator CPDF_Dictionary*() const
+    {
+        return m_pDict;
+    }
+
+    CFX_FloatRect              GetRect();
+
+
+
+    CPDF_Dest                  GetDest(CPDF_Document* pDoc);
+
+    CPDF_Action                        GetAction();
+
+
+    CPDF_Dictionary*   m_pDict;
+};
+#define ANNOTFLAG_INVISIBLE                    1
+#define ANNOTFLAG_HIDDEN                       2
+#define ANNOTFLAG_PRINT                                4
+#define ANNOTFLAG_NOZOOM                       8
+#define ANNOTFLAG_NOROTATE                     0x10
+#define ANNOTFLAG_NOVIEW                       0x20
+#define ANNOTFLAG_READONLY                     0x40
+#define ANNOTFLAG_LOCKED                       0x80
+#define ANNOTFLAG_TOGGLENOVIEW         0x100
+class CPDF_Annot : public CFX_PrivateData, public CFX_Object
+{
+public:
+
+    CPDF_Annot(CPDF_Dictionary* pDict);
+
+    ~CPDF_Annot();
+
+    CPDF_Dictionary*   m_pAnnotDict;
+
+    CFX_ByteString             GetSubType() const;
+
+    FX_DWORD                   GetFlags() const
+    {
+        return m_pAnnotDict->GetInteger("F");
+    }
+
+    void                               GetRect(CFX_FloatRect& rect) const;
+
+    enum AppearanceMode        {
+        Normal,
+        Rollover,
+        Down
+    };
+
+    FX_BOOL                            DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
+                                       AppearanceMode mode, const CPDF_RenderOptions* pOptions);
+
+    FX_BOOL                            DrawInContext(const CPDF_Page* pPage, const CPDF_RenderContext* pContext,
+                                      const CFX_AffineMatrix* pUser2Device, AppearanceMode mode);
+
+    void                               ClearCachedAP();
+
+
+    void                               DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
+                                   const CPDF_RenderOptions* pOptions);
+
+    CPDF_PageObject*   GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions);
+
+
+
+    int                                        CountIRTNotes();
+
+    CPDF_Annot*                        GetIRTNote(int index);
+
+
+    CPDF_Form*                 GetAPForm(const CPDF_Page* pPage, AppearanceMode mode);
+private:
+
+    CFX_MapPtrToPtr            m_APMap;
+protected:
+    friend class               CPDF_AnnotList;
+
+    CPDF_AnnotList*            m_pList;
+
+    CPDF_Reference*            NewAnnotRef();
+};
+class CPDF_AnnotList : public CFX_Object
+{
+public:
+
+    CPDF_AnnotList(CPDF_Page* pPage);
+
+    ~CPDF_AnnotList();
+
+    void       GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix* pUser2Device, CFX_Matrix &matrix) const;
+
+    void       GetAnnotRect(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix* pUser2Device, CPDF_Rect &rtAnnot) const;
+
+    void                               DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,
+                                      CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,
+                                      CPDF_RenderOptions* pOptions);
+
+    void                               DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext,
+                                      FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,
+                                      CPDF_RenderOptions* pOptions)
+    {
+        DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3 : 1, pOptions, NULL);
+    }
+
+    void                               DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext,
+                                      FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,
+                                      CPDF_RenderOptions* pOptions, FX_RECT *pClipRect)
+    {
+        DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3 : 1, pOptions, pClipRect);
+    }
+
+    void                               DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext,
+                                      FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_DWORD dwAnnotFlags,
+                                      CPDF_RenderOptions* pOptions, FX_RECT* pClipRect);
+
+
+
+    CPDF_Annot*                        GetAt(int index)
+    {
+        return (CPDF_Annot*)m_AnnotList.GetAt(index);
+    }
+
+    int                                        Count()
+    {
+        return m_AnnotList.GetSize();
+    }
+
+    int                                        GetIndex(CPDF_Annot* pAnnot);
+
+
+    CPDF_Document*             GetDocument() const
+    {
+        return m_pDocument;
+    }
+protected:
+
+    CFX_PtrArray               m_AnnotList;
+
+    CPDF_Dictionary*   m_pPageDict;
+
+    CPDF_Document*             m_pDocument;
+
+    CFX_PtrArray               m_Borders;
+
+    void                               DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,
+                                    CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix,
+                                    FX_BOOL bWidget, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect);
+    friend class               CPDF_Annot;
+};
+#define COLORTYPE_TRANSPARENT  0
+#define COLORTYPE_GRAY                 1
+#define COLORTYPE_RGB                  2
+#define COLORTYPE_CMYK                 3
+class CPDF_DefaultAppearance : public CFX_Object
+{
+public:
+
+    CPDF_DefaultAppearance(const CFX_ByteString& csDA = "")
+    {
+        m_csDA = csDA;
+    }
+
+    CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA)
+    {
+        m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;
+    }
+
+
+    operator CFX_ByteString() const
+    {
+        return m_csDA;
+    }
+
+    const CPDF_DefaultAppearance& operator =(const CFX_ByteString& csDA)
+    {
+        m_csDA = csDA;
+        return *this;
+    }
+
+    const CPDF_DefaultAppearance& operator =(const CPDF_DefaultAppearance& cDA)
+    {
+        m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;
+        return *this;
+    }
+
+
+
+    FX_BOOL                            HasFont();
+
+    CFX_ByteString             GetFontString();
+
+    void                               GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize);
+
+
+
+
+    FX_BOOL                            HasColor(FX_BOOL bStrokingOperation = FALSE);
+
+    CFX_ByteString             GetColorString(FX_BOOL bStrokingOperation = FALSE);
+
+    void                               GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL bStrokingOperation = FALSE);
+
+    void                               GetColor(FX_ARGB& color, int& iColorType, FX_BOOL bStrokingOperation = FALSE);
+
+
+
+
+    FX_BOOL                            HasTextMatrix();
+
+    CFX_ByteString             GetTextMatrixString();
+
+    CFX_AffineMatrix   GetTextMatrix();
+
+protected:
+
+    CFX_ByteString             m_csDA;
+};
+#define FIELDTYPE_UNKNOWN                      0
+#define FIELDTYPE_PUSHBUTTON           1
+#define FIELDTYPE_CHECKBOX                     2
+#define FIELDTYPE_RADIOBUTTON          3
+#define FIELDTYPE_COMBOBOX                     4
+#define FIELDTYPE_LISTBOX                      5
+#define FIELDTYPE_TEXTFIELD                    6
+#define FIELDTYPE_SIGNATURE                    7
+class CPDF_InterForm : public CFX_PrivateData, public CFX_Object
+{
+public:
+
+    CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP);
+
+    ~CPDF_InterForm();
+
+
+
+    static void                                EnableUpdateAP(FX_BOOL bUpdateAP);
+
+    static FX_BOOL                     UpdatingAPEnabled();
+
+
+    static CFX_ByteString      GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen = 2, FX_LPCSTR csPrefix = "");
+
+
+
+    static CPDF_Font*          AddSystemDefaultFont(const CPDF_Document* pDocument);
+
+    static CPDF_Font*          AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet = 1);
+
+    static CPDF_Font*          AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet = 1);
+
+    static CPDF_Font*          AddStandardFont(const CPDF_Document* pDocument, CFX_ByteString csFontName);
+
+    static CFX_ByteString      GetNativeFont(FX_BYTE iCharSet, FX_LPVOID pLogFont = NULL);
+
+    static CFX_ByteString      GetNativeFont(FX_LPVOID pLogFont = NULL);
+
+    static FX_BYTE                     GetNativeCharSet();
+
+    static CPDF_Font*          AddNativeFont(FX_BYTE iCharSet, const CPDF_Document* pDocument);
+
+    static CPDF_Font*          AddNativeFont(const CPDF_Document* pDocument);
+
+
+
+
+    FX_BOOL                                    ValidateFieldName(CFX_WideString& csNewFieldName, int iType);
+
+    FX_BOOL                                    ValidateFieldName(const CPDF_FormField* pField, CFX_WideString& csNewFieldName);
+
+    FX_BOOL                                    ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName);
+
+
+
+
+    FX_DWORD                           CountFields(const CFX_WideString &csFieldName = L"");
+
+    CPDF_FormField*                    GetField(FX_DWORD index, const CFX_WideString &csFieldName = L"");
+
+    void                                       GetAllFieldNames(CFX_WideStringArray& allFieldNames);
+
+    FX_BOOL                                    IsValidFormField(const void* pField);
+
+    CPDF_FormField*                    GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
+
+
+
+
+    FX_DWORD                           CountControls(CFX_WideString csFieldName = L"");
+
+    CPDF_FormControl*          GetControl(FX_DWORD index, CFX_WideString csFieldName = L"");
+
+    FX_BOOL                                    IsValidFormControl(const void* pControl);
+
+    int                                                CountPageControls(CPDF_Page* pPage) const;
+
+    CPDF_FormControl*          GetPageControl(CPDF_Page* pPage, int index) const;
+
+
+    CPDF_FormControl*          GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y) const;
+
+    CPDF_FormControl*          GetControlByDict(CPDF_Dictionary* pWidgetDict) const;
+
+
+
+
+    FX_DWORD                           CountInternalFields(const CFX_WideString& csFieldName = L"") const;
+
+    CPDF_Dictionary*           GetInternalField(FX_DWORD index, const CFX_WideString& csFieldName = L"") const;
+
+
+
+
+
+    CPDF_Document*                     GetDocument() const
+    {
+        return m_pDocument;
+    }
+
+    CPDF_Dictionary*           GetFormDict() const
+    {
+        return m_pFormDict;
+    }
+
+
+
+
+    FX_BOOL                                    NeedConstructAP();
+
+    void                                       NeedConstructAP(FX_BOOL bNeedAP);
+
+
+
+
+    int                                                CountFieldsInCalculationOrder();
+
+    CPDF_FormField*                    GetFieldInCalculationOrder(int index);
+
+    int                                                FindFieldInCalculationOrder(const CPDF_FormField* pField);
+
+
+
+
+    FX_DWORD                           CountFormFonts();
+
+    CPDF_Font*                         GetFormFont(FX_DWORD index, CFX_ByteString& csNameTag);
+
+    CPDF_Font*                         GetFormFont(CFX_ByteString csNameTag);
+
+    CPDF_Font*                         GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag);
+
+    CPDF_Font*                         GetNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag);
+
+    CPDF_Font*                         GetNativeFormFont(CFX_ByteString& csNameTag);
+
+    FX_BOOL                                    FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag);
+
+    FX_BOOL                                    FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag);
+
+    inline FX_BOOL                     FindFormFont(CFX_WideString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
+    {
+        return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag);
+    }
+
+
+
+
+
+    void                                       AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag);
+
+    CPDF_Font*                         AddNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag);
+
+    CPDF_Font*                         AddNativeFormFont(CFX_ByteString& csNameTag);
+
+    void                                       RemoveFormFont(const CPDF_Font* pFont);
+
+    void                                       RemoveFormFont(CFX_ByteString csNameTag);
+
+
+
+
+    CPDF_DefaultAppearance     GetDefaultAppearance();
+
+    CPDF_Font*                         GetDefaultFormFont();
+
+
+
+    int                                                GetFormAlignment();
+
+
+
+
+    CPDF_FormField*                    CheckRequiredFields(const CFX_PtrArray *fields = NULL, FX_BOOL bIncludeOrExclude = TRUE) const;
+
+    CFDF_Document*                     ExportToFDF(FX_WSTR pdf_path, FX_BOOL bSimpleFileSpec = FALSE) const;
+
+    CFDF_Document*                     ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bSimpleFileSpec = FALSE) const;
+
+    FX_BOOL                                    ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE);
+
+
+
+
+    FX_BOOL                                    ResetForm(const CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bNotify = FALSE);
+
+    FX_BOOL                                    ResetForm(FX_BOOL bNotify = FALSE);
+
+    void                                       ReloadForm();
+
+    CPDF_FormNotify*           GetFormNotify() const
+    {
+        return m_pFormNotify;
+    }
+
+    void                                       SetFormNotify(const CPDF_FormNotify* pNotify);
+
+
+    int                                                GetPageWithWidget(int iCurPage, FX_BOOL bNext);
+
+
+
+    FX_BOOL                                    IsUpdated()
+    {
+        return m_bUpdated;
+    }
+
+    void                                       ClearUpdatedFlag()
+    {
+        m_bUpdated = FALSE;
+    }
+
+
+    FX_BOOL                                    HasXFAForm() const;
+
+    void                                       FixPageFields(const CPDF_Page* pPage);
+protected:
+
+    static FX_BOOL                     m_bUpdateAP;
+
+    void                                       LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0);
+
+    CPDF_Object*                       GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name);
+
+    CPDF_FormField*                    AddTerminalField(const CPDF_Dictionary* pFieldDict);
+
+    CPDF_FormControl*          AddControl(const CPDF_FormField* pField, const CPDF_Dictionary* pWidgetDict);
+
+    void                                       FDF_ImportField(CPDF_Dictionary* pField, const CFX_WideString& parent_name, FX_BOOL bNotify = FALSE, int nLevel = 0);
+
+    FX_BOOL                                    ValidateFieldName(CFX_WideString& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedControl);
+
+    int                                                CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2);
+
+    int                                                CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2);
+
+    CPDF_Document*                     m_pDocument;
+
+    FX_BOOL                                    m_bGenerateAP;
+
+    CPDF_Dictionary*           m_pFormDict;
+
+    CFX_MapPtrToPtr                    m_ControlMap;
+
+    CFieldTree *m_pFieldTree;
+
+    CFX_ByteString                     m_bsEncoding;
+
+    CPDF_FormNotify*           m_pFormNotify;
+
+    FX_BOOL                                    m_bUpdated;
+    friend class CPDF_FormControl;
+    friend class CPDF_FormField;
+};
+#define FORMFIELD_READONLY             0x01
+#define FORMFIELD_REQUIRED             0x02
+#define FORMFIELD_NOEXPORT             0x04
+#define FORMRADIO_NOTOGGLEOFF  0x100
+#define FORMRADIO_UNISON               0x200
+#define FORMTEXT_MULTILINE             0x100
+#define FORMTEXT_PASSWORD              0x200
+#define FORMTEXT_NOSCROLL              0x400
+#define FORMTEXT_COMB                  0x800
+#define FORMCOMBO_EDIT                 0x100
+#define FORMLIST_MULTISELECT   0x100
+class CPDF_FormField : public CFX_Object
+{
+public:
+
+    enum Type {
+        Unknown,
+        PushButton,
+        RadioButton,
+        CheckBox,
+        Text,
+        RichText,
+        File,
+        ListBox,
+        ComboBox,
+        Sign
+    };
+
+    CFX_WideString                     GetFullName();
+
+    Type                                       GetType()
+    {
+        return m_Type;
+    }
+
+    FX_DWORD                           GetFlags()
+    {
+        return m_Flags;
+    }
+
+    CPDF_InterForm*                    GetInterForm() const
+    {
+        return m_pForm;
+    }
+
+    CPDF_Dictionary*           GetFieldDict() const
+    {
+        return m_pDict;
+    }
+
+    void                                       SetFieldDict(CPDF_Dictionary* pDict)
+    {
+        m_pDict = pDict;
+    }
+
+    FX_BOOL                                    ResetField(FX_BOOL bNotify = FALSE);
+
+
+
+    int                                                CountControls()
+    {
+        return m_ControlList.GetSize();
+    }
+
+    CPDF_FormControl*          GetControl(int index)
+    {
+        return (CPDF_FormControl*)m_ControlList.GetAt(index);
+    }
+
+    int                                                GetControlIndex(const CPDF_FormControl* pControl);
+
+
+
+
+    int                                                GetFieldType();
+
+
+
+
+    CPDF_AAction                       GetAdditionalAction();
+
+
+
+
+    CFX_WideString                     GetAlternateName();
+
+
+
+
+    CFX_WideString                     GetMappingName();
+
+
+
+
+    FX_DWORD                           GetFieldFlags();
+
+
+
+
+    CFX_ByteString                     GetDefaultStyle();
+
+
+
+
+    CFX_WideString                     GetRichTextString();
+
+
+
+    CFX_WideString                     GetValue();
+
+    CFX_WideString                     GetDefaultValue();
+
+    FX_BOOL                                    SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE);
+
+
+
+
+
+    int                                                GetMaxLen();
+
+
+
+
+    int                                                CountSelectedItems();
+
+    int                                                GetSelectedIndex(int index);
+
+    FX_BOOL                                    ClearSelection(FX_BOOL bNotify = FALSE);
+
+    FX_BOOL                                    IsItemSelected(int index);
+
+    FX_BOOL                                    SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify = FALSE);
+
+    FX_BOOL                                    IsItemDefaultSelected(int index);
+
+    int                                                GetDefaultSelectedItem();
+
+
+
+
+    int                                                CountOptions();
+
+    CFX_WideString                     GetOptionLabel(int index);
+
+    CFX_WideString                     GetOptionValue(int index);
+
+    int                                                FindOption(CFX_WideString csOptLabel);
+
+    int                                                FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex = 0);
+
+
+
+
+    FX_BOOL                                    CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOOL bNotify = FALSE);
+
+
+
+
+    int                                                GetTopVisibleIndex();
+
+
+
+
+    int                                                CountSelectedOptions();
+
+    int                                                GetSelectedOptionIndex(int index);
+
+    FX_BOOL                                    IsOptionSelected(int iOptIndex);
+
+    FX_BOOL                                    SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL bNotify = FALSE);
+
+    FX_BOOL                                    ClearSelectedOptions(FX_BOOL bNotify = FALSE);
+
+
+
+
+    FX_FLOAT                           GetFontSize()
+    {
+        return m_FontSize;
+    }
+
+    CPDF_Font*                         GetFont()
+    {
+        return m_pFont;
+    }
+
+protected:
+
+    CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
+
+    ~CPDF_FormField();
+
+    CPDF_FormField::Type       m_Type;
+
+    FX_DWORD                           m_Flags;
+
+    CPDF_InterForm*                    m_pForm;
+
+    CPDF_Dictionary*           m_pDict;
+
+    CFX_PtrArray                       m_ControlList;
+    friend class                       CPDF_InterForm;
+    friend class                       CPDF_FormControl;
+
+
+
+    CFX_WideString                     GetValue(FX_BOOL bDefault);
+
+    FX_BOOL                                    SetValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify);
+
+
+    void                                       SyncFieldFlags();
+
+    int                                                FindListSel(CPDF_String* str);
+
+    CFX_WideString                     GetOptionText(int index, int sub_index);
+
+    void                                       LoadDA();
+
+    void                                       UpdateAP(CPDF_FormControl* pControl);
+
+
+
+    CFX_WideString                     GetCheckValue(FX_BOOL bDefault);
+
+    FX_BOOL                                    SetCheckValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify);
+
+
+    FX_FLOAT                           m_FontSize;
+
+    CPDF_Font*                         m_pFont;
+};
+CPDF_Object*   FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name, int nLevel = 0);
+class CPDF_IconFit : public CFX_Object
+{
+public:
+
+    CPDF_IconFit(CPDF_Dictionary* pDict = NULL)
+    {
+        m_pDict = pDict;
+    }
+
+    operator CPDF_Dictionary*() const
+    {
+        return m_pDict;
+    }
+
+
+
+
+    enum ScaleMethod {
+        Always = 0,
+        Bigger,
+        Smaller,
+        Never
+    };
+
+    ScaleMethod                                GetScaleMethod();
+
+
+
+
+    FX_BOOL                                    IsProportionalScale();
+
+
+
+
+    void                                       GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);
+
+
+
+
+    FX_BOOL                                    GetFittingBounds();
+
+
+    CPDF_Dictionary*           m_pDict;
+};
+
+#define TEXTPOS_CAPTION                0
+#define TEXTPOS_ICON           1
+#define TEXTPOS_BELOW          2
+#define TEXTPOS_ABOVE          3
+#define TEXTPOS_RIGHT          4
+#define TEXTPOS_LEFT           5
+#define TEXTPOS_OVERLAID       6
+class CPDF_FormControl : public CFX_Object
+{
+public:
+
+    CPDF_FormField::Type       GetType()
+    {
+        return m_pField->GetType();
+    }
+
+    CPDF_InterForm*                    GetInterForm() const
+    {
+        return m_pForm;
+    }
+
+    CPDF_FormField*                    GetField() const
+    {
+        return m_pField;
+    }
+
+    CPDF_Dictionary*           GetWidget() const
+    {
+        return m_pWidgetDict;
+    }
+
+    CFX_FloatRect                      GetRect();
+
+    void                                       DrawControl(CFX_RenderDevice* pDevice, CFX_AffineMatrix* pMatrix,
+                                        CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions = NULL);
+
+
+
+    CFX_ByteString                     GetCheckedAPState();
+
+    CFX_WideString                     GetExportValue();
+
+    FX_BOOL                                    IsChecked();
+
+    FX_BOOL                                    IsDefaultChecked();
+
+
+
+
+    enum HighlightingMode      {
+        None = 0,
+        Invert,
+        Outline,
+        Push,
+        Toggle
+    };
+
+    HighlightingMode           GetHighlightingMode();
+
+
+
+
+    FX_BOOL                                    HasMKEntry(CFX_ByteString csEntry);
+
+
+
+
+    int                                                GetRotation();
+
+
+
+
+    inline FX_ARGB                     GetBorderColor(int& iColorType)
+    {
+        return GetColor(iColorType, "BC");
+    }
+
+    inline FX_FLOAT                    GetOriginalBorderColor(int index)
+    {
+        return GetOriginalColor(index, "BC");
+    }
+
+    inline void                                GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4])
+    {
+        GetOriginalColor(iColorType, fc, "BC");
+    }
+
+
+
+
+    inline FX_ARGB                     GetBackgroundColor(int& iColorType)
+    {
+        return GetColor(iColorType, "BG");
+    }
+
+    inline FX_FLOAT                    GetOriginalBackgroundColor(int index)
+    {
+        return GetOriginalColor(index, "BG");
+    }
+
+    inline void                                GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4])
+    {
+        GetOriginalColor(iColorType, fc, "BG");
+    }
+
+
+
+
+    inline CFX_WideString      GetNormalCaption()
+    {
+        return GetCaption("CA");
+    }
+
+
+
+
+    inline CFX_WideString      GetRolloverCaption()
+    {
+        return GetCaption("RC");
+    }
+
+
+
+
+    inline CFX_WideString      GetDownCaption()
+    {
+        return GetCaption("AC");
+    }
+
+
+
+
+    inline CPDF_Stream*                GetNormalIcon()
+    {
+        return GetIcon("I");
+    }
+
+
+
+
+    inline CPDF_Stream*                GetRolloverIcon()
+    {
+        return GetIcon("RI");
+    }
+
+
+
+
+    inline CPDF_Stream*                GetDownIcon()
+    {
+        return GetIcon("IX");
+    }
+
+
+
+
+    CPDF_IconFit                       GetIconFit();
+
+
+
+
+    int                                                GetTextPosition();
+
+
+
+
+    CPDF_Action                                GetAction();
+
+
+
+
+    CPDF_AAction                       GetAdditionalAction();
+
+
+
+
+    CPDF_DefaultAppearance     GetDefaultAppearance();
+
+    CPDF_Font*                         GetDefaultControlFont();
+
+
+
+
+    int                                                GetControlAlignment();
+
+protected:
+
+    CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict);
+
+    CFX_ByteString                     GetOnStateName();
+
+    void                                       SetOnStateName(const CFX_ByteString& csOn);
+
+    void                                       CheckControl(FX_BOOL bChecked);
+
+    FX_ARGB                                    GetColor(int& iColorType, CFX_ByteString csEntry);
+
+    FX_FLOAT                           GetOriginalColor(int index, CFX_ByteString csEntry);
+
+    void                                       GetOriginalColor(int& iColorType, FX_FLOAT fc[4], CFX_ByteString csEntry);
+
+    CFX_WideString                     GetCaption(CFX_ByteString csEntry);
+
+    CPDF_Stream*                       GetIcon(CFX_ByteString csEntry);
+
+    CPDF_ApSettings                    GetMK(FX_BOOL bCreate);
+
+    CPDF_InterForm*                    m_pForm;
+
+    CPDF_FormField*                    m_pField;
+
+    CPDF_Dictionary*           m_pWidgetDict;
+    friend class                       CPDF_InterForm;
+    friend class                       CPDF_FormField;
+};
+class CPDF_FormNotify : public CFX_Object
+{
+public:
+
+    virtual ~CPDF_FormNotify() {}
+
+    virtual int                BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue)
+    {
+        return 0;
+    }
+
+    virtual int                AfterValueChange(const CPDF_FormField* pField)
+    {
+        return 0;
+    }
+
+    virtual int                BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue)
+    {
+        return 0;
+    }
+
+    virtual int                AfterSelectionChange(const CPDF_FormField* pField)
+    {
+        return 0;
+    }
+
+    virtual int                AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray)
+    {
+        return 0;
+    }
+
+    virtual int                BeforeFormReset(const CPDF_InterForm* pForm)
+    {
+        return 0;
+    }
+
+    virtual int                AfterFormReset(const CPDF_InterForm* pForm)
+    {
+        return 0;
+    }
+
+    virtual int                BeforeFormImportData(const CPDF_InterForm* pForm)
+    {
+        return 0;
+    }
+
+    virtual int                AfterFormImportData(const CPDF_InterForm* pForm)
+    {
+        return 0;
+    }
+};
+FX_BOOL                FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
+class CPDF_PageLabel : public CFX_Object
+{
+public:
+
+    CPDF_PageLabel(CPDF_Document* pDocument)
+    {
+        m_pDocument = pDocument;
+    }
+
+
+    CFX_WideString                                     GetLabel(int nPage) const;
+
+    FX_INT32                                           GetPageByLabel(FX_BSTR bsLabel) const;
+
+
+    FX_INT32                                           GetPageByLabel(FX_WSTR wsLabel) const;
+
+protected:
+    CPDF_Document*                                     m_pDocument;
+};
+class CPDF_Metadata
+{
+public:
+
+    CPDF_Metadata();
+
+
+    ~CPDF_Metadata();
+
+    void                               LoadDoc(CPDF_Document *pDoc);
+
+
+    FX_INT32                   GetString(FX_BSTR bsItem, CFX_WideString &wsStr);
+
+    CXML_Element*              GetRoot() const;
+
+    CXML_Element*              GetRDF() const;
+
+protected:
+    FX_LPVOID  m_pData;
+};
+class CPDF_ViewerPreferences
+{
+public:
+
+    CPDF_ViewerPreferences(CPDF_Document *pDoc);
+
+
+    ~CPDF_ViewerPreferences();
+
+
+    FX_BOOL IsDirectionR2L() const;
+
+    FX_BOOL PrintScaling() const;
+
+    FX_INT32 NumCopies() const;
+
+    CPDF_Array* PrintPageRange() const;
+
+    CFX_ByteString Duplex() const;
+
+protected:
+    CPDF_Document*     m_pDoc;
+};
+class CPDF_ApSettings : public CFX_Object
+{
+public:
+
+    CPDF_ApSettings(CPDF_Dictionary* pDict = NULL)
+    {
+        m_pDict = pDict;
+    }
+
+    operator CPDF_Dictionary* () const
+    {
+        return m_pDict;
+    }
+
+    FX_BOOL                                    HasMKEntry(FX_BSTR csEntry);
+
+
+
+    int                                                GetRotation();
+
+
+
+
+    inline FX_ARGB                     GetBorderColor(int& iColorType)
+    {
+        return GetColor(iColorType, FX_BSTRC("BC"));
+    }
+
+    inline FX_FLOAT                    GetOriginalBorderColor(int index)
+    {
+        return GetOriginalColor(index, FX_BSTRC("BC"));
+    }
+
+    inline void                                GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4])
+    {
+        GetOriginalColor(iColorType, fc, FX_BSTRC("BC"));
+    }
+
+
+
+
+    inline FX_ARGB                     GetBackgroundColor(int& iColorType)
+    {
+        return GetColor(iColorType, FX_BSTRC("BG"));
+    }
+
+    inline FX_FLOAT                    GetOriginalBackgroundColor(int index)
+    {
+        return GetOriginalColor(index, FX_BSTRC("BG"));
+    }
+
+    inline void                                GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4])
+    {
+        GetOriginalColor(iColorType, fc, FX_BSTRC("BG"));
+    }
+
+
+
+
+    inline CFX_WideString      GetNormalCaption()
+    {
+        return GetCaption(FX_BSTRC("CA"));
+    }
+
+
+
+
+    inline CFX_WideString      GetRolloverCaption()
+    {
+        return GetCaption(FX_BSTRC("RC"));
+    }
+
+
+
+
+    inline CFX_WideString      GetDownCaption()
+    {
+        return GetCaption(FX_BSTRC("AC"));
+    }
+
+
+
+
+    inline CPDF_Stream*                GetNormalIcon()
+    {
+        return GetIcon(FX_BSTRC("I"));
+    }
+
+
+
+
+    inline CPDF_Stream*                GetRolloverIcon()
+    {
+        return GetIcon(FX_BSTRC("RI"));
+    }
+
+
+
+
+    inline CPDF_Stream*                GetDownIcon()
+    {
+        return GetIcon(FX_BSTRC("IX"));
+    }
+
+
+
+
+    CPDF_IconFit                       GetIconFit();
+
+
+
+
+    int                                                GetTextPosition();
+
+    CPDF_Dictionary*           m_pDict;
+protected:
+
+    FX_ARGB                                    GetColor(int& iColorType, FX_BSTR csEntry);
+
+    FX_FLOAT                           GetOriginalColor(int index, FX_BSTR csEntry);
+
+    void                                       GetOriginalColor(int& iColorType, FX_FLOAT fc[4], FX_BSTR csEntry);
+
+    CFX_WideString                     GetCaption(FX_BSTR csEntry);
+
+    CPDF_Stream*                       GetIcon(FX_BSTR csEntry);
+    friend class                       CPDF_FormControl;
+};
+#endif