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