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