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