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