Make conversion between CPDF_Dest and its object explicit.
[pdfium.git] / core / include / fpdfdoc / fpdf_doc.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4  
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _FPDF_DOC_H_
8 #define _FPDF_DOC_H_
9 #ifndef _FPDF_PARSER_
10 #include "../fpdfapi/fpdf_parser.h"
11 #endif
12 #ifndef _FPDF_RENDER_
13 #include "../fpdfapi/fpdf_render.h"
14 #endif
15 class CPDF_Action;
16 class CPDF_Annot;
17 class CPDF_AnnotList;
18 class CPDF_Bookmark;
19 class CPDF_BookmarkTree;
20 class CPDF_Dest;
21 class CPDF_Link;
22 class CPDF_LinkList;
23 class CPDF_Metadata;
24 class CPDF_NameTree;
25 class CPDF_NumberTree;
26 class CPDF_TextObject;
27 class CPDF_ViewerPreferences;
28 class CPDF_Page;
29 class CPDF_RenderOptions;
30 class CXML_Element;
31 class CPDF_OCContext;
32 class CPDF_DocJSActions;
33 class CPDF_ActionFields;
34 class CPDF_AAction;
35 class CPDF_FileSpec;
36 class CPDF_IconFit;
37 class CPDF_DefaultAppearance;
38 class CPDF_InterForm;
39 class CPDF_FormField;
40 class CPDF_FormNotify;
41 class CPDF_FormControl;
42 class CPDF_LWinParam;
43 class CFieldTree;
44 class CPDF_ApSettings;
45 class CPDF_NameTree : public CFX_Object
46 {
47 public:
48
49     CPDF_NameTree(CPDF_Dictionary* pRoot)
50     {
51         m_pRoot = pRoot;
52     }
53
54     CPDF_NameTree(CPDF_Document* pDoc, FX_BSTR category);
55
56     CPDF_Object*                LookupValue(int nIndex, CFX_ByteString& csName) const;
57
58     CPDF_Object*                LookupValue(const CFX_ByteString& csName) const;
59
60     CPDF_Array*                 LookupNamedDest(CPDF_Document* pDoc, FX_BSTR sName);
61
62     int                                 GetIndex(const CFX_ByteString& csName) const;
63
64     int                                 GetCount() const;
65
66
67     CPDF_Dictionary*    GetRoot() const
68     {
69         return m_pRoot;
70     }
71
72 protected:
73
74     CPDF_Dictionary*            m_pRoot;
75 };
76 class CPDF_BookmarkTree : public CFX_Object
77 {
78 public:
79     CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
80
81     CPDF_Bookmark               GetFirstChild(const CPDF_Bookmark& parent) const;
82
83     CPDF_Bookmark               GetNextSibling(const CPDF_Bookmark& bookmark) const;
84
85     CPDF_Document*              GetDocument() const { return m_pDocument; }
86
87 protected:
88     CPDF_Document*              m_pDocument;
89 };
90 #define PDFBOOKMARK_ITALIC                      1
91 #define PDFBOOKMARK_BOLD                        2
92 class CPDF_Bookmark : public CFX_Object
93 {
94 public:
95
96     CPDF_Bookmark() : m_pDict(NULL) {}
97
98     explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
99
100     CPDF_Dictionary* GetDict() const { return m_pDict; }
101
102     operator bool() const { return m_pDict != NULL; }
103
104     FX_DWORD                    GetColorRef() const;
105
106     FX_DWORD                    GetFontStyle() const;
107
108     CFX_WideString              GetTitle() const;
109
110     CPDF_Dest                   GetDest(CPDF_Document* pDocument) const;
111
112     CPDF_Action                 GetAction() const;
113
114     CPDF_Dictionary*    m_pDict;
115 };
116 #define PDFZOOM_XYZ                                     1
117 #define PDFZOOM_FITPAGE                         2
118 #define PDFZOOM_FITHORZ                         3
119 #define PDFZOOM_FITVERT                         4
120 #define PDFZOOM_FITRECT                         5
121 #define PDFZOOM_FITBBOX                         6
122 #define PDFZOOM_FITBHORZ                        7
123 #define PDFZOOM_FITBVERT                        8
124 class CPDF_Dest : public CFX_Object
125 {
126 public:
127     CPDF_Dest() : m_pObj(nullptr) { }
128     explicit CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) { }
129
130     operator bool () const { return m_pObj != NULL; }
131     CPDF_Object* GetObject() const { return m_pObj; }
132
133     CFX_ByteString              GetRemoteName();
134     int                                 GetPageIndex(CPDF_Document* pDoc);
135     FX_DWORD                    GetPageObjNum();
136     int                                 GetZoomMode();
137     FX_FLOAT                    GetParam(int index);
138
139 protected:
140     CPDF_Object*                m_pObj;
141 };
142 class CPDF_OCContext : public CFX_Object, public IPDF_OCContext
143 {
144 public:
145
146     enum UsageType {
147         View = 0,
148         Design,
149         Print,
150         Export
151     };
152
153     CPDF_OCContext(CPDF_Document *pDoc, UsageType eUsageType = View);
154
155     virtual ~CPDF_OCContext();
156
157     CPDF_Document*      GetDocument() const
158     {
159         return m_pDocument;
160     }
161
162     UsageType           GetUsageType() const
163     {
164         return m_eUsageType;
165     }
166
167     FX_BOOL                     CheckOCGVisible(const CPDF_Dictionary *pOCGDict);
168
169     void                        ResetOCContext();
170 protected:
171
172     FX_BOOL                     LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const;
173
174     FX_BOOL                     LoadOCGState(const CPDF_Dictionary *pOCGDict) const;
175
176     FX_BOOL                     GetOCGVisible(const CPDF_Dictionary *pOCGDict);
177
178     FX_BOOL                     GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel = 0);
179
180     FX_BOOL                     LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL bFromConfig);
181
182     CPDF_Document               *m_pDocument;
183
184     UsageType                   m_eUsageType;
185
186     CFX_MapPtrTemplate<const CPDF_Dictionary*, void*>   m_OCGStates;
187 };
188 class CPDF_LWinParam : public CFX_Object
189 {
190 public:
191
192     CPDF_LWinParam(CPDF_Dictionary* pDict)
193     {
194         m_pDict = pDict;
195     }
196
197     operator CPDF_Dictionary* () const
198     {
199         return m_pDict;
200     }
201
202     inline CFX_ByteString       GetFileName()
203     {
204         return m_pDict->GetString("F");
205     }
206
207
208     inline CFX_ByteString       GetDefaultDirectory()
209     {
210         return m_pDict->GetString("D");
211     }
212
213
214     inline CFX_ByteString       GetOperation()
215     {
216         return m_pDict->GetString("O");
217     }
218
219
220     inline CFX_ByteString       GetParameter()
221     {
222         return m_pDict->GetString("P");
223     }
224
225     CPDF_Dictionary*            m_pDict;
226 };
227 class CPDF_ActionFields : public CFX_Object
228 {
229 public:
230
231     CPDF_ActionFields(const CPDF_Action* pAction)
232     {
233         m_pAction = (CPDF_Action*)pAction;
234     }
235
236     operator CPDF_Action*() const
237     {
238         return m_pAction;
239     }
240
241     FX_DWORD                            GetFieldsCount() const;
242
243     void                                        GetAllFields(CFX_PtrArray& fieldObjects) const;
244
245     CPDF_Object*                        GetField(FX_DWORD iIndex) const;
246
247     CPDF_Action*                        m_pAction;
248 };
249
250 #define PDFNAMED_NEXTPAGE               1
251 #define PDFNAMED_PREVPAGE               2
252 #define PDFNAMED_FIRSTPAGE              3
253 #define PDFNAMED_LASTPAGE               4
254 #define PDFJS_MAXLENGTH                 64
255 class CPDF_Action : public CFX_Object
256 {
257 public:
258     enum ActionType {
259         Unknown = 0,
260         GoTo,
261         GoToR,
262         GoToE,
263         Launch,
264         Thread,
265         URI,
266         Sound,
267         Movie,
268         Hide,
269         Named,
270         SubmitForm,
271         ResetForm,
272         ImportData,
273         JavaScript,
274         SetOCGState,
275         Rendition,
276         Trans,
277         GoTo3DView
278     };
279
280     CPDF_Action() : m_pDict(nullptr) { }
281     explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) { }
282
283     operator bool () const { return m_pDict != NULL; }
284
285     CPDF_Dictionary* GetDict() const { return m_pDict; }
286
287     CFX_ByteString              GetTypeName() const
288     {
289         return m_pDict->GetString("S");
290     }
291
292     ActionType                  GetType() const;
293
294
295
296     CPDF_Dest                   GetDest(CPDF_Document* pDoc) const;
297
298
299
300
301
302     CFX_WideString              GetFilePath() const;
303
304
305
306
307     FX_BOOL                             GetNewWindow() const
308     {
309         return m_pDict->GetBoolean("NewWindow");
310     }
311
312
313
314
315     CPDF_LWinParam              GetWinParam() const;
316
317
318
319
320     CFX_ByteString              GetURI(CPDF_Document* pDoc) const;
321
322
323
324
325     FX_BOOL                             GetMouseMap() const
326     {
327         return m_pDict->GetBoolean("IsMap");
328     }
329
330
331
332
333     CPDF_ActionFields   GetWidgets() const
334     {
335         return this;
336     }
337
338
339
340
341     FX_BOOL                             GetHideStatus() const
342     {
343         return m_pDict->GetBoolean("H", TRUE);
344     }
345
346
347
348
349     CFX_ByteString              GetNamedAction() const
350     {
351         return m_pDict->GetString("N");
352     }
353
354
355
356
357     FX_DWORD                    GetFlags() const
358     {
359         return m_pDict->GetInteger("Flags");
360     }
361
362
363
364
365     CFX_WideString              GetJavaScript() const;
366
367
368
369
370     CPDF_Dictionary*    GetAnnot() const;
371
372
373
374
375     FX_INT32                    GetOperationType() const;
376
377
378
379
380     CPDF_Stream*                GetSoundStream() const
381     {
382         return m_pDict->GetStream("Sound");
383     }
384
385     FX_FLOAT                    GetVolume() const
386     {
387         return m_pDict->GetNumber("Volume");
388     }
389
390     FX_BOOL                             IsSynchronous() const
391     {
392         return m_pDict->GetBoolean("Synchronous");
393     }
394
395     FX_BOOL                             IsRepeat() const
396     {
397         return m_pDict->GetBoolean("Repeat");
398     }
399
400     FX_BOOL                             IsMixPlay() const
401     {
402         return m_pDict->GetBoolean("Mix");
403     }
404
405
406
407
408     FX_DWORD                    GetSubActionsCount() const;
409
410     CPDF_Action                 GetSubAction(FX_DWORD iIndex) const;
411
412 protected:
413     CPDF_Dictionary*    m_pDict;
414 };
415 class CPDF_AAction : public CFX_Object
416 {
417 public:
418
419     CPDF_AAction(CPDF_Dictionary* pDict = NULL)
420     {
421         m_pDict = pDict;
422     }
423
424     operator CPDF_Dictionary*() const
425     {
426         return m_pDict;
427     }
428
429     enum AActionType {
430         CursorEnter = 0,
431         CursorExit,
432         ButtonDown,
433         ButtonUp,
434         GetFocus,
435         LoseFocus,
436         PageOpen,
437         PageClose,
438         PageVisible,
439         PageInvisible,
440         OpenPage,
441         ClosePage,
442         KeyStroke,
443         Format,
444         Validate,
445         Calculate,
446         CloseDocument,
447         SaveDocument,
448         DocumentSaved,
449         PrintDocument,
450         DocumentPrinted
451     };
452
453     FX_BOOL                             ActionExist(AActionType eType) const;
454
455     CPDF_Action                 GetAction(AActionType eType) const;
456
457     FX_POSITION                 GetStartPos() const;
458
459     CPDF_Action                 GetNextAction(FX_POSITION& pos, AActionType& eType) const;
460
461     CPDF_Dictionary*    m_pDict;
462 };
463 class CPDF_DocJSActions : public CFX_Object
464 {
465 public:
466     CPDF_DocJSActions(CPDF_Document* pDoc);
467
468
469     int                                 CountJSActions() const;
470
471     CPDF_Action                 GetJSAction(int index, CFX_ByteString& csName) const;
472
473     CPDF_Action                 GetJSAction(const CFX_ByteString& csName) const;
474
475     int                                 FindJSAction(const CFX_ByteString& csName) const;
476
477
478     CPDF_Document*              GetDocument() const
479     {
480         return m_pDocument;
481     }
482
483 protected:
484
485     CPDF_Document*              m_pDocument;
486 };
487 class CPDF_FileSpec : public CFX_Object
488 {
489 public:
490
491     CPDF_FileSpec();
492
493     CPDF_FileSpec(CPDF_Object *pObj)
494     {
495         m_pObj = pObj;
496     }
497
498     operator CPDF_Object*() const
499     {
500         return m_pObj;
501     }
502
503     FX_BOOL                     IsURL() const;
504
505     FX_BOOL                     GetFileName(CFX_WideString &wsFileName) const;
506
507     CPDF_Stream*        GetFileStream() const;
508
509     void                        SetFileName(FX_WSTR wsFileName, FX_BOOL bURL = FALSE);
510 protected:
511
512     CPDF_Object         *m_pObj;
513 };
514 class CPDF_LinkList : public CFX_Object
515 {
516 public:
517
518     CPDF_LinkList(CPDF_Document* pDoc)
519     {
520         m_pDocument = pDoc;
521     }
522
523     ~CPDF_LinkList();
524
525     CPDF_Link                   GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y);
526
527     int                                 CountLinks(CPDF_Page* pPage);
528
529     CPDF_Link                   GetLink(CPDF_Page* pPage, int index);
530
531     CPDF_Document*              GetDocument() const
532     {
533         return m_pDocument;
534     }
535 protected:
536
537     CPDF_Document*              m_pDocument;
538
539     CFX_MapPtrToPtr             m_PageMap;
540
541     CFX_PtrArray*               GetPageLinks(CPDF_Page* pPage);
542
543     void                                LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList);
544 };
545 class CPDF_Link : public CFX_Object
546 {
547 public:
548
549     CPDF_Link(CPDF_Dictionary* pDict = NULL)
550     {
551         m_pDict = pDict;
552     }
553
554     operator CPDF_Dictionary*() const
555     {
556         return m_pDict;
557     }
558
559     CFX_FloatRect               GetRect();
560
561
562
563     CPDF_Dest                   GetDest(CPDF_Document* pDoc);
564
565     CPDF_Action                 GetAction();
566
567
568     CPDF_Dictionary*    m_pDict;
569 };
570 #define ANNOTFLAG_INVISIBLE                     1
571 #define ANNOTFLAG_HIDDEN                        2
572 #define ANNOTFLAG_PRINT                         4
573 #define ANNOTFLAG_NOZOOM                        8
574 #define ANNOTFLAG_NOROTATE                      0x10
575 #define ANNOTFLAG_NOVIEW                        0x20
576 #define ANNOTFLAG_READONLY                      0x40
577 #define ANNOTFLAG_LOCKED                        0x80
578 #define ANNOTFLAG_TOGGLENOVIEW          0x100
579 class CPDF_Annot : public CFX_PrivateData, public CFX_Object
580 {
581 public:
582
583     CPDF_Annot(CPDF_Dictionary* pDict);
584
585     ~CPDF_Annot();
586
587     CPDF_Dictionary*    m_pAnnotDict;
588
589     CFX_ByteString              GetSubType() const;
590
591     FX_DWORD                    GetFlags() const
592     {
593         return m_pAnnotDict->GetInteger("F");
594     }
595
596     void                                GetRect(CFX_FloatRect& rect) const;
597
598     enum AppearanceMode {
599         Normal,
600         Rollover,
601         Down
602     };
603
604     FX_BOOL                             DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
605                                        AppearanceMode mode, const CPDF_RenderOptions* pOptions);
606
607     FX_BOOL                             DrawInContext(const CPDF_Page* pPage, const CPDF_RenderContext* pContext,
608                                       const CFX_AffineMatrix* pUser2Device, AppearanceMode mode);
609
610     void                                ClearCachedAP();
611
612
613     void                                DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pUser2Device,
614                                    const CPDF_RenderOptions* pOptions);
615
616     CPDF_PageObject*    GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions* pOptions);
617
618
619
620     int                                 CountIRTNotes();
621
622     CPDF_Annot*                 GetIRTNote(int index);
623
624
625     CPDF_Form*                  GetAPForm(const CPDF_Page* pPage, AppearanceMode mode);
626 private:
627
628     CFX_MapPtrToPtr             m_APMap;
629 protected:
630     friend class                CPDF_AnnotList;
631
632     CPDF_AnnotList*             m_pList;
633
634     CPDF_Reference*             NewAnnotRef();
635 };
636 class CPDF_AnnotList : public CFX_Object
637 {
638 public:
639
640     CPDF_AnnotList(CPDF_Page* pPage);
641
642     ~CPDF_AnnotList();
643
644     void        GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix* pUser2Device, CFX_Matrix &matrix) const;
645
646     void        GetAnnotRect(const CPDF_Dictionary* pAnnotDict, const CFX_Matrix* pUser2Device, CPDF_Rect &rtAnnot) const;
647
648     void                                DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,
649                                       CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,
650                                       CPDF_RenderOptions* pOptions);
651
652     void                                DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext,
653                                       FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,
654                                       CPDF_RenderOptions* pOptions)
655     {
656         DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3 : 1, pOptions, NULL);
657     }
658
659     void                                DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext,
660                                       FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget,
661                                       CPDF_RenderOptions* pOptions, FX_RECT *pClipRect)
662     {
663         DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, bShowWidget ? 3 : 1, pOptions, pClipRect);
664     }
665
666     void                                DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext,
667                                       FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_DWORD dwAnnotFlags,
668                                       CPDF_RenderOptions* pOptions, FX_RECT* pClipRect);
669
670
671
672     CPDF_Annot*                 GetAt(int index)
673     {
674         return (CPDF_Annot*)m_AnnotList.GetAt(index);
675     }
676
677     int                                 Count()
678     {
679         return m_AnnotList.GetSize();
680     }
681
682     int                                 GetIndex(CPDF_Annot* pAnnot);
683
684
685     CPDF_Document*              GetDocument() const
686     {
687         return m_pDocument;
688     }
689 protected:
690
691     CFX_PtrArray                m_AnnotList;
692
693     CPDF_Dictionary*    m_pPageDict;
694
695     CPDF_Document*              m_pDocument;
696
697     CFX_PtrArray                m_Borders;
698
699     void                                DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevice,
700                                     CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix,
701                                     FX_BOOL bWidget, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect);
702     friend class                CPDF_Annot;
703 };
704 #define COLORTYPE_TRANSPARENT   0
705 #define COLORTYPE_GRAY                  1
706 #define COLORTYPE_RGB                   2
707 #define COLORTYPE_CMYK                  3
708 class CPDF_DefaultAppearance : public CFX_Object
709 {
710 public:
711
712     CPDF_DefaultAppearance(const CFX_ByteString& csDA = "")
713     {
714         m_csDA = csDA;
715     }
716
717     CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA)
718     {
719         m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;
720     }
721
722
723     operator CFX_ByteString() const
724     {
725         return m_csDA;
726     }
727
728     const CPDF_DefaultAppearance& operator =(const CFX_ByteString& csDA)
729     {
730         m_csDA = csDA;
731         return *this;
732     }
733
734     const CPDF_DefaultAppearance& operator =(const CPDF_DefaultAppearance& cDA)
735     {
736         m_csDA = (CFX_ByteString)(CPDF_DefaultAppearance&)cDA;
737         return *this;
738     }
739
740
741
742     FX_BOOL                             HasFont();
743
744     CFX_ByteString              GetFontString();
745
746     void                                GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize);
747
748
749
750
751     FX_BOOL                             HasColor(FX_BOOL bStrokingOperation = FALSE);
752
753     CFX_ByteString              GetColorString(FX_BOOL bStrokingOperation = FALSE);
754
755     void                                GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL bStrokingOperation = FALSE);
756
757     void                                GetColor(FX_ARGB& color, int& iColorType, FX_BOOL bStrokingOperation = FALSE);
758
759
760
761
762     FX_BOOL                             HasTextMatrix();
763
764     CFX_ByteString              GetTextMatrixString();
765
766     CFX_AffineMatrix    GetTextMatrix();
767
768 protected:
769
770     CFX_ByteString              m_csDA;
771 };
772 #define FIELDTYPE_UNKNOWN                       0
773 #define FIELDTYPE_PUSHBUTTON            1
774 #define FIELDTYPE_CHECKBOX                      2
775 #define FIELDTYPE_RADIOBUTTON           3
776 #define FIELDTYPE_COMBOBOX                      4
777 #define FIELDTYPE_LISTBOX                       5
778 #define FIELDTYPE_TEXTFIELD                     6
779 #define FIELDTYPE_SIGNATURE                     7
780 class CPDF_InterForm : public CFX_PrivateData, public CFX_Object
781 {
782 public:
783
784     CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP);
785
786     ~CPDF_InterForm();
787
788
789
790     static void                         EnableUpdateAP(FX_BOOL bUpdateAP);
791
792     static FX_BOOL                      UpdatingAPEnabled();
793
794
795     static CFX_ByteString       GenerateNewResourceName(const CPDF_Dictionary* pResDict, FX_LPCSTR csType, int iMinLen = 2, FX_LPCSTR csPrefix = "");
796
797
798
799     static CPDF_Font*           AddSystemDefaultFont(const CPDF_Document* pDocument);
800
801     static CPDF_Font*           AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet = 1);
802
803     static CPDF_Font*           AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet = 1);
804
805     static CPDF_Font*           AddStandardFont(const CPDF_Document* pDocument, CFX_ByteString csFontName);
806
807     static CFX_ByteString       GetNativeFont(FX_BYTE iCharSet, FX_LPVOID pLogFont = NULL);
808
809     static CFX_ByteString       GetNativeFont(FX_LPVOID pLogFont = NULL);
810
811     static FX_BYTE                      GetNativeCharSet();
812
813     static CPDF_Font*           AddNativeFont(FX_BYTE iCharSet, const CPDF_Document* pDocument);
814
815     static CPDF_Font*           AddNativeFont(const CPDF_Document* pDocument);
816
817
818
819
820     FX_BOOL                                     ValidateFieldName(CFX_WideString& csNewFieldName, int iType);
821
822     FX_BOOL                                     ValidateFieldName(const CPDF_FormField* pField, CFX_WideString& csNewFieldName);
823
824     FX_BOOL                                     ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName);
825
826
827
828
829     FX_DWORD                            CountFields(const CFX_WideString &csFieldName = L"");
830
831     CPDF_FormField*                     GetField(FX_DWORD index, const CFX_WideString &csFieldName = L"");
832
833     void                                        GetAllFieldNames(CFX_WideStringArray& allFieldNames);
834
835     FX_BOOL                                     IsValidFormField(const void* pField);
836
837     CPDF_FormField*                     GetFieldByDict(CPDF_Dictionary* pFieldDict) const;
838
839
840
841
842     FX_DWORD                            CountControls(CFX_WideString csFieldName = L"");
843
844     CPDF_FormControl*           GetControl(FX_DWORD index, CFX_WideString csFieldName = L"");
845
846     FX_BOOL                                     IsValidFormControl(const void* pControl);
847
848     int                                         CountPageControls(CPDF_Page* pPage) const;
849
850     CPDF_FormControl*           GetPageControl(CPDF_Page* pPage, int index) const;
851
852
853     CPDF_FormControl*           GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y) const;
854
855     CPDF_FormControl*           GetControlByDict(CPDF_Dictionary* pWidgetDict) const;
856
857
858
859
860     FX_DWORD                            CountInternalFields(const CFX_WideString& csFieldName = L"") const;
861
862     CPDF_Dictionary*            GetInternalField(FX_DWORD index, const CFX_WideString& csFieldName = L"") const;
863
864
865
866
867
868     CPDF_Document*                      GetDocument() const
869     {
870         return m_pDocument;
871     }
872
873     CPDF_Dictionary*            GetFormDict() const
874     {
875         return m_pFormDict;
876     }
877
878
879
880
881     FX_BOOL                                     NeedConstructAP();
882
883     void                                        NeedConstructAP(FX_BOOL bNeedAP);
884
885
886
887
888     int                                         CountFieldsInCalculationOrder();
889
890     CPDF_FormField*                     GetFieldInCalculationOrder(int index);
891
892     int                                         FindFieldInCalculationOrder(const CPDF_FormField* pField);
893
894
895
896
897     FX_DWORD                            CountFormFonts();
898
899     CPDF_Font*                          GetFormFont(FX_DWORD index, CFX_ByteString& csNameTag);
900
901     CPDF_Font*                          GetFormFont(CFX_ByteString csNameTag);
902
903     CPDF_Font*                          GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag);
904
905     CPDF_Font*                          GetNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag);
906
907     CPDF_Font*                          GetNativeFormFont(CFX_ByteString& csNameTag);
908
909     FX_BOOL                                     FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag);
910
911     FX_BOOL                                     FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag);
912
913     inline FX_BOOL                      FindFormFont(CFX_WideString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag)
914     {
915         return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag);
916     }
917
918
919
920
921
922     void                                        AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag);
923
924     CPDF_Font*                          AddNativeFormFont(FX_BYTE iCharSet, CFX_ByteString& csNameTag);
925
926     CPDF_Font*                          AddNativeFormFont(CFX_ByteString& csNameTag);
927
928     void                                        RemoveFormFont(const CPDF_Font* pFont);
929
930     void                                        RemoveFormFont(CFX_ByteString csNameTag);
931
932
933
934
935     CPDF_DefaultAppearance      GetDefaultAppearance();
936
937     CPDF_Font*                          GetDefaultFormFont();
938
939
940
941     int                                         GetFormAlignment();
942
943
944
945
946     CPDF_FormField*                     CheckRequiredFields(const CFX_PtrArray *fields = NULL, FX_BOOL bIncludeOrExclude = TRUE) const;
947
948     CFDF_Document*                      ExportToFDF(FX_WSTR pdf_path, FX_BOOL bSimpleFileSpec = FALSE) const;
949
950     CFDF_Document*                      ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bSimpleFileSpec = FALSE) const;
951
952     FX_BOOL                                     ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE);
953
954
955
956
957     FX_BOOL                                     ResetForm(const CFX_PtrArray& fields, FX_BOOL bIncludeOrExclude = TRUE, FX_BOOL bNotify = FALSE);
958
959     FX_BOOL                                     ResetForm(FX_BOOL bNotify = FALSE);
960
961     void                                        ReloadForm();
962
963     CPDF_FormNotify*            GetFormNotify() const
964     {
965         return m_pFormNotify;
966     }
967
968     void                                        SetFormNotify(const CPDF_FormNotify* pNotify);
969
970
971     int                                         GetPageWithWidget(int iCurPage, FX_BOOL bNext);
972
973
974
975     FX_BOOL                                     IsUpdated()
976     {
977         return m_bUpdated;
978     }
979
980     void                                        ClearUpdatedFlag()
981     {
982         m_bUpdated = FALSE;
983     }
984
985
986     FX_BOOL                                     HasXFAForm() const;
987
988     void                                        FixPageFields(const CPDF_Page* pPage);
989 protected:
990
991     static FX_BOOL                      m_bUpdateAP;
992
993     void                                        LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0);
994
995     CPDF_Object*                        GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name);
996
997     CPDF_FormField*                     AddTerminalField(const CPDF_Dictionary* pFieldDict);
998
999     CPDF_FormControl*           AddControl(const CPDF_FormField* pField, const CPDF_Dictionary* pWidgetDict);
1000
1001     void                                        FDF_ImportField(CPDF_Dictionary* pField, const CFX_WideString& parent_name, FX_BOOL bNotify = FALSE, int nLevel = 0);
1002
1003     FX_BOOL                                     ValidateFieldName(CFX_WideString& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedControl);
1004
1005     int                                         CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2);
1006
1007     int                                         CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2);
1008
1009     CPDF_Document*                      m_pDocument;
1010
1011     FX_BOOL                                     m_bGenerateAP;
1012
1013     CPDF_Dictionary*            m_pFormDict;
1014
1015     CFX_MapPtrToPtr                     m_ControlMap;
1016
1017     CFieldTree *m_pFieldTree;
1018
1019     CFX_ByteString                      m_bsEncoding;
1020
1021     CPDF_FormNotify*            m_pFormNotify;
1022
1023     FX_BOOL                                     m_bUpdated;
1024     friend class CPDF_FormControl;
1025     friend class CPDF_FormField;
1026 };
1027 #define FORMFIELD_READONLY              0x01
1028 #define FORMFIELD_REQUIRED              0x02
1029 #define FORMFIELD_NOEXPORT              0x04
1030 #define FORMRADIO_NOTOGGLEOFF   0x100
1031 #define FORMRADIO_UNISON                0x200
1032 #define FORMTEXT_MULTILINE              0x100
1033 #define FORMTEXT_PASSWORD               0x200
1034 #define FORMTEXT_NOSCROLL               0x400
1035 #define FORMTEXT_COMB                   0x800
1036 #define FORMCOMBO_EDIT                  0x100
1037 #define FORMLIST_MULTISELECT    0x100
1038 class CPDF_FormField : public CFX_Object
1039 {
1040 public:
1041
1042     enum Type {
1043         Unknown,
1044         PushButton,
1045         RadioButton,
1046         CheckBox,
1047         Text,
1048         RichText,
1049         File,
1050         ListBox,
1051         ComboBox,
1052         Sign
1053     };
1054
1055     CFX_WideString                      GetFullName();
1056
1057     Type                                        GetType()
1058     {
1059         return m_Type;
1060     }
1061
1062     FX_DWORD                            GetFlags()
1063     {
1064         return m_Flags;
1065     }
1066
1067     CPDF_InterForm*                     GetInterForm() const
1068     {
1069         return m_pForm;
1070     }
1071
1072     CPDF_Dictionary*            GetFieldDict() const
1073     {
1074         return m_pDict;
1075     }
1076
1077     void                                        SetFieldDict(CPDF_Dictionary* pDict)
1078     {
1079         m_pDict = pDict;
1080     }
1081
1082     FX_BOOL                                     ResetField(FX_BOOL bNotify = FALSE);
1083
1084
1085
1086     int                                         CountControls()
1087     {
1088         return m_ControlList.GetSize();
1089     }
1090
1091     CPDF_FormControl*           GetControl(int index)
1092     {
1093         return (CPDF_FormControl*)m_ControlList.GetAt(index);
1094     }
1095
1096     int                                         GetControlIndex(const CPDF_FormControl* pControl);
1097
1098
1099
1100
1101     int                                         GetFieldType();
1102
1103
1104
1105
1106     CPDF_AAction                        GetAdditionalAction();
1107
1108
1109
1110
1111     CFX_WideString                      GetAlternateName();
1112
1113
1114
1115
1116     CFX_WideString                      GetMappingName();
1117
1118
1119
1120
1121     FX_DWORD                            GetFieldFlags();
1122
1123
1124
1125
1126     CFX_ByteString                      GetDefaultStyle();
1127
1128
1129
1130
1131     CFX_WideString                      GetRichTextString();
1132
1133
1134
1135     CFX_WideString                      GetValue();
1136
1137     CFX_WideString                      GetDefaultValue();
1138
1139     FX_BOOL                                     SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE);
1140
1141
1142
1143
1144
1145     int                                         GetMaxLen();
1146
1147
1148
1149
1150     int                                         CountSelectedItems();
1151
1152     int                                         GetSelectedIndex(int index);
1153
1154     FX_BOOL                                     ClearSelection(FX_BOOL bNotify = FALSE);
1155
1156     FX_BOOL                                     IsItemSelected(int index);
1157
1158     FX_BOOL                                     SetItemSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify = FALSE);
1159
1160     FX_BOOL                                     IsItemDefaultSelected(int index);
1161
1162     int                                         GetDefaultSelectedItem();
1163
1164
1165
1166
1167     int                                         CountOptions();
1168
1169     CFX_WideString                      GetOptionLabel(int index);
1170
1171     CFX_WideString                      GetOptionValue(int index);
1172
1173     int                                         FindOption(CFX_WideString csOptLabel);
1174
1175     int                                         FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex = 0);
1176
1177
1178
1179
1180     FX_BOOL                                     CheckControl(int iControlIndex, FX_BOOL bChecked, FX_BOOL bNotify = FALSE);
1181
1182
1183
1184
1185     int                                         GetTopVisibleIndex();
1186
1187
1188
1189
1190     int                                         CountSelectedOptions();
1191
1192     int                                         GetSelectedOptionIndex(int index);
1193
1194     FX_BOOL                                     IsOptionSelected(int iOptIndex);
1195
1196     FX_BOOL                                     SelectOption(int iOptIndex, FX_BOOL bSelected, FX_BOOL bNotify = FALSE);
1197
1198     FX_BOOL                                     ClearSelectedOptions(FX_BOOL bNotify = FALSE);
1199
1200
1201
1202
1203     FX_FLOAT                            GetFontSize()
1204     {
1205         return m_FontSize;
1206     }
1207
1208     CPDF_Font*                          GetFont()
1209     {
1210         return m_pFont;
1211     }
1212
1213 protected:
1214
1215     CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict);
1216
1217     ~CPDF_FormField();
1218
1219     CPDF_FormField::Type        m_Type;
1220
1221     FX_DWORD                            m_Flags;
1222
1223     CPDF_InterForm*                     m_pForm;
1224
1225     CPDF_Dictionary*            m_pDict;
1226
1227     CFX_PtrArray                        m_ControlList;
1228     friend class                        CPDF_InterForm;
1229     friend class                        CPDF_FormControl;
1230
1231
1232
1233     CFX_WideString                      GetValue(FX_BOOL bDefault);
1234
1235     FX_BOOL                                     SetValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify);
1236
1237
1238     void                                        SyncFieldFlags();
1239
1240     int                                         FindListSel(CPDF_String* str);
1241
1242     CFX_WideString                      GetOptionText(int index, int sub_index);
1243
1244     void                                        LoadDA();
1245
1246     void                                        UpdateAP(CPDF_FormControl* pControl);
1247
1248
1249
1250     CFX_WideString                      GetCheckValue(FX_BOOL bDefault);
1251
1252     FX_BOOL                                     SetCheckValue(const CFX_WideString& value, FX_BOOL bDefault, FX_BOOL bNotify);
1253
1254
1255     FX_FLOAT                            m_FontSize;
1256
1257     CPDF_Font*                          m_pFont;
1258 };
1259 CPDF_Object*    FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name, int nLevel = 0);
1260 class CPDF_IconFit : public CFX_Object
1261 {
1262 public:
1263
1264     CPDF_IconFit(CPDF_Dictionary* pDict = NULL)
1265     {
1266         m_pDict = pDict;
1267     }
1268
1269     operator CPDF_Dictionary*() const
1270     {
1271         return m_pDict;
1272     }
1273
1274
1275
1276
1277     enum ScaleMethod {
1278         Always = 0,
1279         Bigger,
1280         Smaller,
1281         Never
1282     };
1283
1284     ScaleMethod                         GetScaleMethod();
1285
1286
1287
1288
1289     FX_BOOL                                     IsProportionalScale();
1290
1291
1292
1293
1294     void                                        GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom);
1295
1296
1297
1298
1299     FX_BOOL                                     GetFittingBounds();
1300
1301
1302     CPDF_Dictionary*            m_pDict;
1303 };
1304
1305 #define TEXTPOS_CAPTION         0
1306 #define TEXTPOS_ICON            1
1307 #define TEXTPOS_BELOW           2
1308 #define TEXTPOS_ABOVE           3
1309 #define TEXTPOS_RIGHT           4
1310 #define TEXTPOS_LEFT            5
1311 #define TEXTPOS_OVERLAID        6
1312 class CPDF_FormControl : public CFX_Object
1313 {
1314 public:
1315
1316     CPDF_FormField::Type        GetType()
1317     {
1318         return m_pField->GetType();
1319     }
1320
1321     CPDF_InterForm*                     GetInterForm() const
1322     {
1323         return m_pForm;
1324     }
1325
1326     CPDF_FormField*                     GetField() const
1327     {
1328         return m_pField;
1329     }
1330
1331     CPDF_Dictionary*            GetWidget() const
1332     {
1333         return m_pWidgetDict;
1334     }
1335
1336     CFX_FloatRect                       GetRect();
1337
1338     void                                        DrawControl(CFX_RenderDevice* pDevice, CFX_AffineMatrix* pMatrix,
1339                                         CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions = NULL);
1340
1341
1342
1343     CFX_ByteString                      GetCheckedAPState();
1344
1345     CFX_WideString                      GetExportValue();
1346
1347     FX_BOOL                                     IsChecked();
1348
1349     FX_BOOL                                     IsDefaultChecked();
1350
1351
1352
1353
1354     enum HighlightingMode       {
1355         None = 0,
1356         Invert,
1357         Outline,
1358         Push,
1359         Toggle
1360     };
1361
1362     HighlightingMode            GetHighlightingMode();
1363
1364
1365
1366
1367     FX_BOOL                                     HasMKEntry(CFX_ByteString csEntry);
1368
1369
1370
1371
1372     int                                         GetRotation();
1373
1374
1375
1376
1377     inline FX_ARGB                      GetBorderColor(int& iColorType)
1378     {
1379         return GetColor(iColorType, "BC");
1380     }
1381
1382     inline FX_FLOAT                     GetOriginalBorderColor(int index)
1383     {
1384         return GetOriginalColor(index, "BC");
1385     }
1386
1387     inline void                         GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4])
1388     {
1389         GetOriginalColor(iColorType, fc, "BC");
1390     }
1391
1392
1393
1394
1395     inline FX_ARGB                      GetBackgroundColor(int& iColorType)
1396     {
1397         return GetColor(iColorType, "BG");
1398     }
1399
1400     inline FX_FLOAT                     GetOriginalBackgroundColor(int index)
1401     {
1402         return GetOriginalColor(index, "BG");
1403     }
1404
1405     inline void                         GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4])
1406     {
1407         GetOriginalColor(iColorType, fc, "BG");
1408     }
1409
1410
1411
1412
1413     inline CFX_WideString       GetNormalCaption()
1414     {
1415         return GetCaption("CA");
1416     }
1417
1418
1419
1420
1421     inline CFX_WideString       GetRolloverCaption()
1422     {
1423         return GetCaption("RC");
1424     }
1425
1426
1427
1428
1429     inline CFX_WideString       GetDownCaption()
1430     {
1431         return GetCaption("AC");
1432     }
1433
1434
1435
1436
1437     inline CPDF_Stream*         GetNormalIcon()
1438     {
1439         return GetIcon("I");
1440     }
1441
1442
1443
1444
1445     inline CPDF_Stream*         GetRolloverIcon()
1446     {
1447         return GetIcon("RI");
1448     }
1449
1450
1451
1452
1453     inline CPDF_Stream*         GetDownIcon()
1454     {
1455         return GetIcon("IX");
1456     }
1457
1458
1459
1460
1461     CPDF_IconFit                        GetIconFit();
1462
1463
1464
1465
1466     int                                         GetTextPosition();
1467
1468
1469
1470
1471     CPDF_Action                         GetAction();
1472
1473
1474
1475
1476     CPDF_AAction                        GetAdditionalAction();
1477
1478
1479
1480
1481     CPDF_DefaultAppearance      GetDefaultAppearance();
1482
1483     CPDF_Font*                          GetDefaultControlFont();
1484
1485
1486
1487
1488     int                                         GetControlAlignment();
1489
1490 protected:
1491
1492     CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict);
1493
1494     CFX_ByteString                      GetOnStateName();
1495
1496     void                                        SetOnStateName(const CFX_ByteString& csOn);
1497
1498     void                                        CheckControl(FX_BOOL bChecked);
1499
1500     FX_ARGB                                     GetColor(int& iColorType, CFX_ByteString csEntry);
1501
1502     FX_FLOAT                            GetOriginalColor(int index, CFX_ByteString csEntry);
1503
1504     void                                        GetOriginalColor(int& iColorType, FX_FLOAT fc[4], CFX_ByteString csEntry);
1505
1506     CFX_WideString                      GetCaption(CFX_ByteString csEntry);
1507
1508     CPDF_Stream*                        GetIcon(CFX_ByteString csEntry);
1509
1510     CPDF_ApSettings                     GetMK(FX_BOOL bCreate);
1511
1512     CPDF_InterForm*                     m_pForm;
1513
1514     CPDF_FormField*                     m_pField;
1515
1516     CPDF_Dictionary*            m_pWidgetDict;
1517     friend class                        CPDF_InterForm;
1518     friend class                        CPDF_FormField;
1519 };
1520 class CPDF_FormNotify : public CFX_Object
1521 {
1522 public:
1523
1524     virtual ~CPDF_FormNotify() {}
1525
1526     virtual int         BeforeValueChange(const CPDF_FormField* pField, CFX_WideString& csValue)
1527     {
1528         return 0;
1529     }
1530
1531     virtual int         AfterValueChange(const CPDF_FormField* pField)
1532     {
1533         return 0;
1534     }
1535
1536     virtual int         BeforeSelectionChange(const CPDF_FormField* pField, CFX_WideString& csValue)
1537     {
1538         return 0;
1539     }
1540
1541     virtual int         AfterSelectionChange(const CPDF_FormField* pField)
1542     {
1543         return 0;
1544     }
1545
1546     virtual int         AfterCheckedStatusChange(const CPDF_FormField* pField, const CFX_ByteArray& statusArray)
1547     {
1548         return 0;
1549     }
1550
1551     virtual int         BeforeFormReset(const CPDF_InterForm* pForm)
1552     {
1553         return 0;
1554     }
1555
1556     virtual int         AfterFormReset(const CPDF_InterForm* pForm)
1557     {
1558         return 0;
1559     }
1560
1561     virtual int         BeforeFormImportData(const CPDF_InterForm* pForm)
1562     {
1563         return 0;
1564     }
1565
1566     virtual int         AfterFormImportData(const CPDF_InterForm* pForm)
1567     {
1568         return 0;
1569     }
1570 };
1571 FX_BOOL         FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
1572 class CPDF_PageLabel : public CFX_Object
1573 {
1574 public:
1575
1576     CPDF_PageLabel(CPDF_Document* pDocument)
1577     {
1578         m_pDocument = pDocument;
1579     }
1580
1581
1582     CFX_WideString                                      GetLabel(int nPage) const;
1583
1584     FX_INT32                                            GetPageByLabel(FX_BSTR bsLabel) const;
1585
1586
1587     FX_INT32                                            GetPageByLabel(FX_WSTR wsLabel) const;
1588
1589 protected:
1590     CPDF_Document*                                      m_pDocument;
1591 };
1592 class CPDF_Metadata
1593 {
1594 public:
1595
1596     CPDF_Metadata();
1597
1598
1599     ~CPDF_Metadata();
1600
1601     void                                LoadDoc(CPDF_Document *pDoc);
1602
1603
1604     FX_INT32                    GetString(FX_BSTR bsItem, CFX_WideString &wsStr);
1605
1606     CXML_Element*               GetRoot() const;
1607
1608     CXML_Element*               GetRDF() const;
1609
1610 protected:
1611     FX_LPVOID   m_pData;
1612 };
1613 class CPDF_ViewerPreferences
1614 {
1615 public:
1616
1617     CPDF_ViewerPreferences(CPDF_Document *pDoc);
1618
1619
1620     ~CPDF_ViewerPreferences();
1621
1622
1623     FX_BOOL IsDirectionR2L() const;
1624
1625     FX_BOOL PrintScaling() const;
1626
1627     FX_INT32 NumCopies() const;
1628
1629     CPDF_Array* PrintPageRange() const;
1630
1631     CFX_ByteString Duplex() const;
1632
1633 protected:
1634     CPDF_Document*      m_pDoc;
1635 };
1636 class CPDF_ApSettings : public CFX_Object
1637 {
1638 public:
1639
1640     CPDF_ApSettings(CPDF_Dictionary* pDict = NULL)
1641     {
1642         m_pDict = pDict;
1643     }
1644
1645     operator CPDF_Dictionary* () const
1646     {
1647         return m_pDict;
1648     }
1649
1650     FX_BOOL                                     HasMKEntry(FX_BSTR csEntry);
1651
1652
1653
1654     int                                         GetRotation();
1655
1656
1657
1658
1659     inline FX_ARGB                      GetBorderColor(int& iColorType)
1660     {
1661         return GetColor(iColorType, FX_BSTRC("BC"));
1662     }
1663
1664     inline FX_FLOAT                     GetOriginalBorderColor(int index)
1665     {
1666         return GetOriginalColor(index, FX_BSTRC("BC"));
1667     }
1668
1669     inline void                         GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4])
1670     {
1671         GetOriginalColor(iColorType, fc, FX_BSTRC("BC"));
1672     }
1673
1674
1675
1676
1677     inline FX_ARGB                      GetBackgroundColor(int& iColorType)
1678     {
1679         return GetColor(iColorType, FX_BSTRC("BG"));
1680     }
1681
1682     inline FX_FLOAT                     GetOriginalBackgroundColor(int index)
1683     {
1684         return GetOriginalColor(index, FX_BSTRC("BG"));
1685     }
1686
1687     inline void                         GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4])
1688     {
1689         GetOriginalColor(iColorType, fc, FX_BSTRC("BG"));
1690     }
1691
1692
1693
1694
1695     inline CFX_WideString       GetNormalCaption()
1696     {
1697         return GetCaption(FX_BSTRC("CA"));
1698     }
1699
1700
1701
1702
1703     inline CFX_WideString       GetRolloverCaption()
1704     {
1705         return GetCaption(FX_BSTRC("RC"));
1706     }
1707
1708
1709
1710
1711     inline CFX_WideString       GetDownCaption()
1712     {
1713         return GetCaption(FX_BSTRC("AC"));
1714     }
1715
1716
1717
1718
1719     inline CPDF_Stream*         GetNormalIcon()
1720     {
1721         return GetIcon(FX_BSTRC("I"));
1722     }
1723
1724
1725
1726
1727     inline CPDF_Stream*         GetRolloverIcon()
1728     {
1729         return GetIcon(FX_BSTRC("RI"));
1730     }
1731
1732
1733
1734
1735     inline CPDF_Stream*         GetDownIcon()
1736     {
1737         return GetIcon(FX_BSTRC("IX"));
1738     }
1739
1740
1741
1742
1743     CPDF_IconFit                        GetIconFit();
1744
1745
1746
1747
1748     int                                         GetTextPosition();
1749
1750     CPDF_Dictionary*            m_pDict;
1751 protected:
1752
1753     FX_ARGB                                     GetColor(int& iColorType, FX_BSTR csEntry);
1754
1755     FX_FLOAT                            GetOriginalColor(int index, FX_BSTR csEntry);
1756
1757     void                                        GetOriginalColor(int& iColorType, FX_FLOAT fc[4], FX_BSTR csEntry);
1758
1759     CFX_WideString                      GetCaption(FX_BSTR csEntry);
1760
1761     CPDF_Stream*                        GetIcon(FX_BSTR csEntry);
1762     friend class                        CPDF_FormControl;
1763 };
1764 #endif