OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FSDK_BASEANNOT_H_ | 7 #ifndef _FSDK_BASEANNOT_H_ |
8 #define _FSDK_BASEANNOT_H_ | 8 #define _FSDK_BASEANNOT_H_ |
9 | 9 |
10 #if _FX_OS_ == _FX_ANDROID_ | 10 #if _FX_OS_ == _FX_ANDROID_ |
11 #include "time.h" | 11 #include "time.h" |
12 #else | 12 #else |
13 #include <ctime> | 13 #include <ctime> |
14 #endif | 14 #endif |
15 | 15 |
16 class CPDFSDK_PageView; | 16 class CPDFSDK_PageView; |
17 #define CFX_IntArray» » » » CFX_ArrayTemplate<int> | 17 #define CFX_IntArray CFX_ArrayTemplate<int> |
18 | 18 |
19 class CPDFSDK_DateTime : public CFX_Object | 19 class CPDFSDK_DateTime : public CFX_Object { |
20 { | 20 public: |
21 public: | 21 CPDFSDK_DateTime(); |
22 » CPDFSDK_DateTime(); | 22 CPDFSDK_DateTime(const CFX_ByteString& dtStr); |
23 » CPDFSDK_DateTime(const CFX_ByteString& dtStr); | 23 CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime); |
24 » CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime); | 24 CPDFSDK_DateTime(const FX_SYSTEMTIME& st); |
25 » CPDFSDK_DateTime(const FX_SYSTEMTIME& st); | 25 |
26 » | 26 CPDFSDK_DateTime& operator=(const CPDFSDK_DateTime& datetime); |
27 » | 27 CPDFSDK_DateTime& operator=(const FX_SYSTEMTIME& st); |
28 » CPDFSDK_DateTime&» operator = (const CPDFSDK_DateTime& datetime); | 28 FX_BOOL operator==(CPDFSDK_DateTime& datetime); |
29 » CPDFSDK_DateTime&» operator = (const FX_SYSTEMTIME& st); | 29 FX_BOOL operator!=(CPDFSDK_DateTime& datetime); |
30 » FX_BOOL»» » » operator == (CPDFSDK_DateTime& datetime)
; | 30 FX_BOOL operator>(CPDFSDK_DateTime& datetime); |
31 » FX_BOOL»» » » operator != (CPDFSDK_DateTime& datetime)
; | 31 FX_BOOL operator>=(CPDFSDK_DateTime& datetime); |
32 » FX_BOOL»» » » operator > (CPDFSDK_DateTime& datetime); | 32 FX_BOOL operator<(CPDFSDK_DateTime& datetime); |
33 » FX_BOOL»» » » operator >= (CPDFSDK_DateTime& datetime)
; | 33 FX_BOOL operator<=(CPDFSDK_DateTime& datetime); |
34 » FX_BOOL»» » » operator < (CPDFSDK_DateTime& datetime); | 34 operator time_t(); |
35 » FX_BOOL»» » » operator <= (CPDFSDK_DateTime& datetime)
;» | 35 |
36 » » » » » » operator time_t(); | 36 CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr); |
37 » | 37 CFX_ByteString ToCommonDateTimeString(); |
38 » CPDFSDK_DateTime&» FromPDFDateTimeString(const CFX_ByteString& dtSt
r); | 38 CFX_ByteString ToPDFDateTimeString(); |
39 » CFX_ByteString» » ToCommonDateTimeString(); | 39 void ToSystemTime(FX_SYSTEMTIME& st); |
40 » CFX_ByteString» » ToPDFDateTimeString(); | 40 CPDFSDK_DateTime ToGMT(); |
41 » void» » » » ToSystemTime(FX_SYSTEMTIME& st); | 41 CPDFSDK_DateTime& AddDays(short days); |
42 » CPDFSDK_DateTime» ToGMT(); | 42 CPDFSDK_DateTime& AddSeconds(int seconds); |
43 » CPDFSDK_DateTime&» AddDays(short days); | 43 |
44 » CPDFSDK_DateTime&» AddSeconds(int seconds); | 44 void ResetDateTime(); |
45 » | 45 |
46 » void» » » » ResetDateTime(); | 46 struct FX_DATETIME { |
47 » | 47 FX_SHORT year; |
48 » struct FX_DATETIME | 48 FX_BYTE month; |
49 » { | 49 FX_BYTE day; |
50 » » FX_SHORT» year; | 50 FX_BYTE hour; |
51 » » FX_BYTE»» month; | 51 FX_BYTE minute; |
52 » » FX_BYTE»» day; | 52 FX_BYTE second; |
53 » » FX_BYTE»» hour; | 53 FX_CHAR tzHour; |
54 » » FX_BYTE»» minute; | 54 FX_BYTE tzMinute; |
55 » » FX_BYTE»» second; | 55 } dt; |
56 » » FX_CHAR»» tzHour; | |
57 » » FX_BYTE»» tzMinute; | |
58 » }dt; | |
59 }; | 56 }; |
60 | 57 |
61 class CPDFSDK_Annot | 58 class CPDFSDK_Annot { |
62 { | 59 public: |
63 public: | 60 CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); |
64 » CPDFSDK_Annot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView); | 61 virtual ~CPDFSDK_Annot(); |
65 » virtual ~CPDFSDK_Annot(); | |
66 public: | |
67 » virtual FX_FLOAT» » » GetMinWidth() const; | |
68 » virtual FX_FLOAT» » » GetMinHeight() const; | |
69 » //define layout order to 5. | |
70 » virtual int» » » » » GetLayoutOrder() const {
return 5; } | |
71 | 62 |
72 public: | 63 public: |
73 » CPDF_Annot*» » » » » GetPDFAnnot(); | 64 virtual FX_FLOAT GetMinWidth() const; |
74 » | 65 virtual FX_FLOAT GetMinHeight() const; |
75 » void» » » » » » SetPage(CPDFSDK_PageView
* pPageView); | 66 // define layout order to 5. |
76 » CPDFSDK_PageView*» » » GetPageView();» | 67 virtual int GetLayoutOrder() const { return 5; } |
77 » FX_DWORD» » » » » GetFlags(); | |
78 » | |
79 » // Tab Order» | |
80 » int» » » » » » » GetTabOrder(); | |
81 » void» » » » » » SetTabOrder(int iTabOrde
r); | |
82 » | |
83 » // Selection | |
84 » FX_BOOL»» » » » » IsSelected(); | |
85 » void» » » » » » SetSelected(FX_BOOL bSel
ected); | |
86 » | |
87 » CFX_ByteString» » » » GetType() const; | |
88 » virtual CFX_ByteString» » GetSubType() const; | |
89 | 68 |
90 » CPDF_Page*» » » » » GetPDFPage(); | 69 public: |
| 70 CPDF_Annot* GetPDFAnnot(); |
91 | 71 |
92 public: | 72 void SetPage(CPDFSDK_PageView* pPageView); |
93 » CPDF_Dictionary*» » » GetAnnotDict() const; | 73 CPDFSDK_PageView* GetPageView(); |
94 » | 74 FX_DWORD GetFlags(); |
95 » void» » » » » » SetRect(const CPDF_Rect&
rect); | |
96 » CPDF_Rect» » » » » GetRect() const; | |
97 » | |
98 » void» » » » » » SetContents(const CFX_Wi
deString& sContents); | |
99 » CFX_WideString» » » » GetContents() const; | |
100 » | |
101 » void» » » » » » SetAnnotName(const CFX_W
ideString& sName); | |
102 » CFX_WideString» » » » GetAnnotName() const; | |
103 » | |
104 » void» » » » » » SetModifiedDate(const FX
_SYSTEMTIME& st); | |
105 » FX_SYSTEMTIME» » » » GetModifiedDate() const; | |
106 | 75 |
107 » void» » » » » » SetFlags(int nFlags); | 76 // Tab Order |
108 » int» » » » » » » GetFlags() const
; | 77 int GetTabOrder(); |
| 78 void SetTabOrder(int iTabOrder); |
109 | 79 |
110 » void» » » » » » SetAppState(const CFX_By
teString& str); | 80 // Selection |
111 » CFX_ByteString» » » » GetAppState() const; | 81 FX_BOOL IsSelected(); |
112 » | 82 void SetSelected(FX_BOOL bSelected); |
113 » void» » » » » » SetStructParent(int key)
; | |
114 » int» » » » » » » GetStructParent(
) const; | |
115 » | |
116 » //border | |
117 » void» » » » » » SetBorderWidth(int nWidt
h); | |
118 » int» » » » » » » GetBorderWidth()
const; | |
119 » | |
120 » //BBS_SOLID | |
121 » //BBS_DASH | |
122 » //BBS_BEVELED | |
123 » //BBS_INSET | |
124 » //BBS_UNDERLINE | |
125 » | |
126 » void» » » » » » SetBorderStyle(int nStyl
e); | |
127 » int» » » » » » » GetBorderStyle()
const; | |
128 » | |
129 » void» » » » » » SetBorderDash(const CFX_
IntArray& array); | |
130 » void» » » » » » GetBorderDash(CFX_IntArr
ay& array) const; | |
131 » | |
132 » //The background of the annotation's icon when closed | |
133 » //The title bar of the annotation's pop-up window | |
134 » //The border of a link annotation | |
135 » | |
136 » void» » » » » » SetColor(FX_COLORREF col
or); | |
137 » void» » » » » » RemoveColor(); | |
138 » FX_BOOL»» » » » » GetColor(FX_COLORREF& co
lor) const; | |
139 » | |
140 » FX_BOOL»» » » » » IsVisible() const; | |
141 » //action | |
142 | 83 |
143 » CPDF_Action» » » » » GetAction() const; | 84 CFX_ByteString GetType() const; |
144 » void» » » » » » SetAction(const CPDF_Act
ion& a); | 85 virtual CFX_ByteString GetSubType() const; |
145 » void» » » » » » RemoveAction(); | |
146 » | |
147 » CPDF_AAction» » » » GetAAction() const; | |
148 » void» » » » » » SetAAction(const CPDF_AA
ction& aa); | |
149 » void» » » » » » RemoveAAction(); | |
150 » | |
151 » virtual CPDF_Action» » » GetAAction(CPDF_AAction::AAction
Type eAAT); | |
152 » | |
153 public: | |
154 » FX_BOOL»» » » » » IsAppearanceValid(); | |
155 » FX_BOOL»» » » » » IsAppearanceValid(CPDF_A
nnot::AppearanceMode mode); | |
156 » void» » » » » » DrawAppearance(CFX_Rende
rDevice* pDevice, const CPDF_Matrix* pUser2Device, | |
157 » » CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOpti
ons); | |
158 » void» » » » » » DrawBorder(CFX_RenderDev
ice* pDevice, const CPDF_Matrix* pUser2Device, | |
159 » » const CPDF_RenderOptions* pOptions); | |
160 » | |
161 » void» » » » » » ClearCachedAP(); | |
162 » | |
163 » void» » » » » » WriteAppearance(const CF
X_ByteString& sAPType, const CPDF_Rect& rcBBox, | |
164 » » const CPDF_Matrix& matrix, const CFX_ByteString& sContents, | |
165 » » const CFX_ByteString& sAPState = ""); | |
166 | 86 |
167 public: | 87 CPDF_Page* GetPDFPage(); |
168 » virtual void» » » Annot_OnDraw(CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,CPDF_RenderOptions* pOptions); | |
169 public: | |
170 | 88 |
| 89 public: |
| 90 CPDF_Dictionary* GetAnnotDict() const; |
171 | 91 |
172 private: | 92 void SetRect(const CPDF_Rect& rect); |
173 » FX_BOOL CreateFormFiller(); | 93 CPDF_Rect GetRect() const; |
174 protected: | 94 |
175 » CPDF_Annot*» » » m_pAnnot; | 95 void SetContents(const CFX_WideString& sContents); |
176 » CPDFSDK_PageView*» m_pPageView; | 96 CFX_WideString GetContents() const; |
177 » FX_BOOL»» » » m_bSelected; | 97 |
178 » int» » » » » m_nTabOrder; | 98 void SetAnnotName(const CFX_WideString& sName); |
179 » | 99 CFX_WideString GetAnnotName() const; |
| 100 |
| 101 void SetModifiedDate(const FX_SYSTEMTIME& st); |
| 102 FX_SYSTEMTIME GetModifiedDate() const; |
| 103 |
| 104 void SetFlags(int nFlags); |
| 105 int GetFlags() const; |
| 106 |
| 107 void SetAppState(const CFX_ByteString& str); |
| 108 CFX_ByteString GetAppState() const; |
| 109 |
| 110 void SetStructParent(int key); |
| 111 int GetStructParent() const; |
| 112 |
| 113 // border |
| 114 void SetBorderWidth(int nWidth); |
| 115 int GetBorderWidth() const; |
| 116 |
| 117 // BBS_SOLID |
| 118 // BBS_DASH |
| 119 // BBS_BEVELED |
| 120 // BBS_INSET |
| 121 // BBS_UNDERLINE |
| 122 |
| 123 void SetBorderStyle(int nStyle); |
| 124 int GetBorderStyle() const; |
| 125 |
| 126 void SetBorderDash(const CFX_IntArray& array); |
| 127 void GetBorderDash(CFX_IntArray& array) const; |
| 128 |
| 129 // The background of the annotation's icon when closed |
| 130 // The title bar of the annotation's pop-up window |
| 131 // The border of a link annotation |
| 132 |
| 133 void SetColor(FX_COLORREF color); |
| 134 void RemoveColor(); |
| 135 FX_BOOL GetColor(FX_COLORREF& color) const; |
| 136 |
| 137 FX_BOOL IsVisible() const; |
| 138 // action |
| 139 |
| 140 CPDF_Action GetAction() const; |
| 141 void SetAction(const CPDF_Action& a); |
| 142 void RemoveAction(); |
| 143 |
| 144 CPDF_AAction GetAAction() const; |
| 145 void SetAAction(const CPDF_AAction& aa); |
| 146 void RemoveAAction(); |
| 147 |
| 148 virtual CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT); |
| 149 |
| 150 public: |
| 151 FX_BOOL IsAppearanceValid(); |
| 152 FX_BOOL IsAppearanceValid(CPDF_Annot::AppearanceMode mode); |
| 153 void DrawAppearance(CFX_RenderDevice* pDevice, |
| 154 const CPDF_Matrix* pUser2Device, |
| 155 CPDF_Annot::AppearanceMode mode, |
| 156 const CPDF_RenderOptions* pOptions); |
| 157 void DrawBorder(CFX_RenderDevice* pDevice, |
| 158 const CPDF_Matrix* pUser2Device, |
| 159 const CPDF_RenderOptions* pOptions); |
| 160 |
| 161 void ClearCachedAP(); |
| 162 |
| 163 void WriteAppearance(const CFX_ByteString& sAPType, |
| 164 const CPDF_Rect& rcBBox, |
| 165 const CPDF_Matrix& matrix, |
| 166 const CFX_ByteString& sContents, |
| 167 const CFX_ByteString& sAPState = ""); |
| 168 |
| 169 public: |
| 170 virtual void Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 171 CPDF_Matrix* pUser2Device, |
| 172 CPDF_RenderOptions* pOptions); |
| 173 |
| 174 public: |
| 175 private: |
| 176 FX_BOOL CreateFormFiller(); |
| 177 |
| 178 protected: |
| 179 CPDF_Annot* m_pAnnot; |
| 180 CPDFSDK_PageView* m_pPageView; |
| 181 FX_BOOL m_bSelected; |
| 182 int m_nTabOrder; |
180 }; | 183 }; |
181 | 184 |
182 | |
183 | |
184 #endif | 185 #endif |
185 | |
OLD | NEW |