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 #include "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 8 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
9 #include "../include/fpdfxfa/fpdfxfa_util.h" | 9 #include "../include/fpdfxfa/fpdfxfa_util.h" |
10 #include "../include/fsdk_mgr.h" | 10 #include "../include/fsdk_mgr.h" |
11 #include "../include/formfiller/FFL_FormFiller.h" | 11 #include "../include/formfiller/FFL_FormFiller.h" |
12 #include "../include/fsdk_annothandler.h" | 12 #include "../include/fsdk_annothandler.h" |
13 | 13 |
14 | 14 |
15 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) | 15 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) |
16 { | 16 { |
17 » m_pApp = pApp; | 17 m_pApp = pApp; |
18 | 18 |
19 » CPDFSDK_BFAnnotHandler* pHandler = new CPDFSDK_BFAnnotHandler(m_pApp); | 19 CPDFSDK_BFAnnotHandler* pHandler = new CPDFSDK_BFAnnotHandler(m_pApp); |
20 » pHandler->SetFormFiller(m_pApp->GetIFormFiller()); | 20 pHandler->SetFormFiller(m_pApp->GetIFormFiller()); |
21 » RegisterAnnotHandler(pHandler); | 21 RegisterAnnotHandler(pHandler); |
22 | 22 |
23 » CPDFSDK_XFAAnnotHandler* pXFAAnnotHandler = new CPDFSDK_XFAAnnotHandler(
m_pApp); | 23 CPDFSDK_XFAAnnotHandler* pXFAAnnotHandler = new CPDFSDK_XFAAnnotHandler(m_pA
pp); |
24 » RegisterAnnotHandler(pXFAAnnotHandler); | 24 RegisterAnnotHandler(pXFAAnnotHandler); |
25 } | 25 } |
26 | 26 |
27 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() | 27 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() |
28 { | 28 { |
29 » for(int i=0; i<m_Handlers.GetSize(); i++) | 29 for(int i=0; i<m_Handlers.GetSize(); i++) |
30 » { | 30 { |
31 » » IPDFSDK_AnnotHandler* pHandler = m_Handlers.GetAt(i); | 31 IPDFSDK_AnnotHandler* pHandler = m_Handlers.GetAt(i); |
32 » » delete pHandler; | 32 delete pHandler; |
33 » } | 33 } |
34 » m_Handlers.RemoveAll(); | 34 m_Handlers.RemoveAll(); |
35 » m_mapType2Handler.RemoveAll(); | 35 m_mapType2Handler.RemoveAll(); |
36 } | 36 } |
37 | 37 |
38 void» CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnn
otHandler) | 38 void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnn
otHandler) |
39 { | 39 { |
40 » ASSERT(pAnnotHandler != NULL); | 40 ASSERT(pAnnotHandler != NULL); |
41 | 41 |
42 » ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL); | 42 ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL); |
43 | 43 |
44 » m_Handlers.Add(pAnnotHandler); | 44 m_Handlers.Add(pAnnotHandler); |
45 » m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler); | 45 m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler); |
46 } | 46 } |
47 | 47 |
48 void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnno
tHandler) | 48 void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnno
tHandler) |
49 { | 49 { |
50 » ASSERT(pAnnotHandler != NULL); | 50 ASSERT(pAnnotHandler != NULL); |
51 | 51 |
52 » m_mapType2Handler.RemoveKey(pAnnotHandler->GetType()); | 52 m_mapType2Handler.RemoveKey(pAnnotHandler->GetType()); |
53 | 53 |
54 » for (int i=0, sz=m_Handlers.GetSize(); i<sz; i++) | 54 for (int i=0, sz=m_Handlers.GetSize(); i<sz; i++) |
55 » { | 55 { |
56 » » if (m_Handlers.GetAt(i) == pAnnotHandler) | 56 if (m_Handlers.GetAt(i) == pAnnotHandler) |
57 » » { | 57 { |
58 » » » m_Handlers.RemoveAt(i); | 58 m_Handlers.RemoveAt(i); |
59 » » » break; | 59 break; |
60 » » } | 60 } |
61 » } | 61 } |
62 } | 62 } |
63 | 63 |
64 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_Pa
geView *pPageView) | 64 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_Pa
geView *pPageView) |
65 { | 65 { |
66 » ASSERT(pAnnot != NULL); | 66 ASSERT(pAnnot != NULL); |
67 » ASSERT(pPageView != NULL); | 67 ASSERT(pPageView != NULL); |
68 | 68 |
69 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSub
Type())) | 69 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSubType
())) |
70 » { | 70 { |
71 » » return pAnnotHandler->NewAnnot(pAnnot, pPageView); | 71 return pAnnotHandler->NewAnnot(pAnnot, pPageView); |
72 » } | 72 } |
73 | 73 |
74 » return new CPDFSDK_BAAnnot(pAnnot, pPageView); | 74 return new CPDFSDK_BAAnnot(pAnnot, pPageView); |
75 } | 75 } |
76 | 76 |
77 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_Pa
geView* pPageView) | 77 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_Pa
geView* pPageView) |
78 { | 78 { |
79 » ASSERT(pAnnot != NULL); | 79 ASSERT(pAnnot != NULL); |
80 » ASSERT(pPageView != NULL); | 80 ASSERT(pPageView != NULL); |
81 | 81 |
82 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET
_TYPENAME)) | 82 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(FSDK_XFAWIDGET_TYP
ENAME)) |
83 » { | 83 { |
84 » » return pAnnotHandler->NewAnnot(pAnnot, pPageView); | 84 return pAnnotHandler->NewAnnot(pAnnot, pPageView); |
85 » } | 85 } |
86 | 86 |
87 » return NULL; | 87 return NULL; |
88 } | 88 } |
89 | 89 |
90 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 90 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
91 { | 91 { |
92 » ASSERT(pAnnot != NULL); | 92 ASSERT(pAnnot != NULL); |
93 | 93 |
94 » pAnnot->GetPDFPage(); | 94 pAnnot->GetPDFPage(); |
95 | 95 |
96 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 96 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
97 » { | 97 { |
98 » » pAnnotHandler->OnRelease(pAnnot); | 98 pAnnotHandler->OnRelease(pAnnot); |
99 » » pAnnotHandler->ReleaseAnnot(pAnnot); | 99 pAnnotHandler->ReleaseAnnot(pAnnot); |
100 » } | 100 } |
101 » else | 101 else |
102 » { | 102 { |
103 » » delete (CPDFSDK_Annot*)pAnnot; | 103 delete (CPDFSDK_Annot*)pAnnot; |
104 » } | 104 } |
105 } | 105 } |
106 | 106 |
107 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) | 107 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) |
108 { | 108 { |
109 » ASSERT(pAnnot != NULL); | 109 ASSERT(pAnnot != NULL); |
110 | 110 |
111 » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 111 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
112 | 112 |
113 » CPDFSDK_DateTime curTime; | 113 CPDFSDK_DateTime curTime; |
114 » pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString(
)); | 114 pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); |
115 » pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); | 115 pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); |
116 | 116 |
117 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 117 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
118 » { | 118 { |
119 » » pAnnotHandler->OnCreate(pAnnot); | 119 pAnnotHandler->OnCreate(pAnnot); |
120 » } | 120 } |
121 } | 121 } |
122 | 122 |
123 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) | 123 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) |
124 { | 124 { |
125 » ASSERT(pAnnot != NULL); | 125 ASSERT(pAnnot != NULL); |
126 | 126 |
127 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 127 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
128 » { | 128 { |
129 » » pAnnotHandler->OnLoad(pAnnot); | 129 pAnnotHandler->OnLoad(pAnnot); |
130 » } | 130 } |
131 } | 131 } |
132 | 132 |
133 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(CPDFSDK_Annot* pA
nnot) const | 133 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(CPDFSDK_Annot* pA
nnot) const |
134 { | 134 { |
135 » ASSERT(pAnnot != NULL); | 135 ASSERT(pAnnot != NULL); |
136 | 136 |
137 » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 137 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
138 » if (pPDFAnnot) | 138 if (pPDFAnnot) |
139 » » return GetAnnotHandler(pPDFAnnot->GetSubType()); | 139 return GetAnnotHandler(pPDFAnnot->GetSubType()); |
140 » else if (pAnnot->GetXFAWidget()) | 140 else if (pAnnot->GetXFAWidget()) |
141 » » return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME); | 141 return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME); |
142 » return NULL; | 142 return NULL; |
143 } | 143 } |
144 | 144 |
145 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(const CFX_ByteStr
ing& sType) const | 145 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(const CFX_ByteStr
ing& sType) const |
146 { | 146 { |
147 » void* pRet = NULL; | 147 void* pRet = NULL; |
148 » m_mapType2Handler.Lookup(sType, pRet); | 148 m_mapType2Handler.Lookup(sType, pRet); |
149 » return (IPDFSDK_AnnotHandler*)pRet; | 149 return (IPDFSDK_AnnotHandler*)pRet; |
150 } | 150 } |
151 | 151 |
152 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_
Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwF
lags) | 152 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_
Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwF
lags) |
153 { | 153 { |
154 » ASSERT(pAnnot != NULL); | 154 ASSERT(pAnnot != NULL); |
155 | 155 |
156 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 156 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
157 » { | 157 { |
158 » » pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device,
dwFlags); | 158 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags)
; |
159 » } | 159 } |
160 » else | 160 else |
161 » { | 161 { |
162 » » if (!pAnnot->IsXFAField()) | 162 if (!pAnnot->IsXFAField()) |
163 » » » ((CPDFSDK_BAAnnot*)pAnnot)->DrawAppearance(pDevice, pUse
r2Device, CPDF_Annot::Normal, NULL); | 163 ((CPDFSDK_BAAnnot*)pAnnot)->DrawAppearance(pDevice, pUser2Device, CP
DF_Annot::Normal, NULL); |
164 » } | 164 } |
165 } | 165 } |
166 | 166 |
167 | 167 |
168 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 168 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
169 { | 169 { |
170 » ASSERT(pAnnot != NULL); | 170 ASSERT(pAnnot != NULL); |
171 | 171 |
172 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 172 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
173 » { | 173 { |
174 » » return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, p
oint); | 174 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
175 » } | 175 } |
176 » return FALSE; | 176 return FALSE; |
177 } | 177 } |
178 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 178 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
179 { | 179 { |
180 » ASSERT(pAnnot != NULL); | 180 ASSERT(pAnnot != NULL); |
181 | 181 |
182 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 182 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
183 » { | 183 { |
184 » » return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, poi
nt); | 184 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
185 » } | 185 } |
186 » return FALSE; | 186 return FALSE; |
187 } | 187 } |
188 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageV
iew, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 188 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageV
iew, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
189 { | 189 { |
190 » ASSERT(pAnnot != NULL); | 190 ASSERT(pAnnot != NULL); |
191 | 191 |
192 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 192 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
193 » { | 193 { |
194 » » return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags,
point); | 194 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
195 » } | 195 } |
196 » return FALSE; | 196 return FALSE; |
197 } | 197 } |
198 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 198 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
199 { | 199 { |
200 » ASSERT(pAnnot != NULL); | 200 ASSERT(pAnnot != NULL); |
201 | 201 |
202 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 202 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
203 » { | 203 { |
204 » » return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, poi
nt); | 204 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); |
205 » } | 205 } |
206 » return FALSE; | 206 return FALSE; |
207 } | 207 } |
208 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView
, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 208 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView
, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
209 { | 209 { |
210 » ASSERT(pAnnot != NULL); | 210 ASSERT(pAnnot != NULL); |
211 | 211 |
212 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 212 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
213 » { | 213 { |
214 » » return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDel
ta, point); | 214 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDelta, poin
t); |
215 » } | 215 } |
216 » return FALSE; | 216 return FALSE; |
217 } | 217 } |
218 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 218 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
219 { | 219 { |
220 » ASSERT(pAnnot != NULL); | 220 ASSERT(pAnnot != NULL); |
221 | 221 |
222 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 222 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
223 » { | 223 { |
224 » » return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, p
oint); | 224 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
225 » } | 225 } |
226 » return FALSE; | 226 return FALSE; |
227 } | 227 } |
228 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 228 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
229 { | 229 { |
230 » ASSERT(pAnnot != NULL); | 230 ASSERT(pAnnot != NULL); |
231 | 231 |
232 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 232 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
233 » { | 233 { |
234 » » return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, poi
nt); | 234 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
235 » } | 235 } |
236 » return FALSE; | 236 return FALSE; |
237 } | 237 } |
238 | 238 |
239 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlag) | 239 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
240 { | 240 { |
241 » ASSERT(pAnnot != NULL); | 241 ASSERT(pAnnot != NULL); |
242 | 242 |
243 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 243 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
244 » { | 244 { |
245 » » pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); | 245 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); |
246 » } | 246 } |
247 » return ; | 247 return ; |
248 } | 248 } |
249 | 249 |
250 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlag) | 250 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlag) |
251 { | 251 { |
252 » ASSERT(pAnnot != NULL); | 252 ASSERT(pAnnot != NULL); |
253 | 253 |
254 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 254 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
255 » { | 255 { |
256 » » pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); | 256 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); |
257 » } | 257 } |
258 » return; | 258 return; |
259 } | 259 } |
260 | 260 |
261 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nC
har, FX_DWORD nFlags) | 261 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nC
har, FX_DWORD nFlags) |
262 { | 262 { |
263 | 263 |
264 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 264 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
265 » { | 265 { |
266 » » return pAnnotHandler->OnChar(pAnnot,nChar, nFlags); | 266 return pAnnotHandler->OnChar(pAnnot,nChar, nFlags); |
267 » } | 267 } |
268 » return FALSE; | 268 return FALSE; |
269 | 269 |
270 } | 270 } |
271 | 271 |
272 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot*
pAnnot, int nKeyCode, int nFlag) | 272 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
int nKeyCode, int nFlag) |
273 { | 273 { |
274 | 274 |
275 » if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag
)) | 275 if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag)) |
276 » { | 276 { |
277 » » CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 277 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
278 » » CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); | 278 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); |
279 » » if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) | 279 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) |
280 » » { | 280 { |
281 » » » CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp
->FFI_IsSHIFTKeyDown(nFlag)); | 281 CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp->FFI_IsSHIF
TKeyDown(nFlag)); |
282 | 282 |
283 » » » if(pNext && pNext != pFocusAnnot) | 283 if(pNext && pNext != pFocusAnnot) |
284 » » » { | 284 { |
285 » » » » CPDFSDK_Document* pDocument = pPage->GetSDKDocum
ent(); | 285 CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); |
286 » » » » pDocument->SetFocusAnnot(pNext); | 286 pDocument->SetFocusAnnot(pNext); |
287 » » » » return TRUE; | 287 return TRUE; |
288 » » » } | 288 } |
289 » » } | 289 } |
290 » } | 290 } |
291 | 291 |
292 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 292 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
293 » { | 293 { |
294 » » return pAnnotHandler->OnKeyDown(pAnnot,nKeyCode, nFlag); | 294 return pAnnotHandler->OnKeyDown(pAnnot,nKeyCode, nFlag); |
295 » } | 295 } |
296 » return FALSE; | 296 return FALSE; |
297 } | 297 } |
298 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pA
nnot, int nKeyCode, int nFlag) | 298 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, in
t nKeyCode, int nFlag) |
299 { | 299 { |
300 » return FALSE; | 300 return FALSE; |
301 } | 301 } |
302 | 302 |
303 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot*
pAnnot, FX_DWORD nFlag) | 303 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) |
304 { | 304 { |
305 » ASSERT(pAnnot != NULL); | 305 ASSERT(pAnnot != NULL); |
306 | 306 |
307 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 307 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
308 » { | 308 { |
309 » » if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) | 309 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) |
310 » » { | 310 { |
311 » » » CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 311 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
312 » » » ASSERT(pPage != NULL); | 312 ASSERT(pPage != NULL); |
313 | 313 |
314 » » » pPage->GetSDKDocument(); | 314 pPage->GetSDKDocument(); |
315 » //» » pDocument->SetTopmostAnnot(pAnnot); | 315 // pDocument->SetTopmostAnnot(pAnnot); |
316 | 316 |
317 » » » return TRUE; | 317 return TRUE; |
318 » » } | 318 } |
319 » » else | 319 else |
320 » » { | 320 { |
321 » » » return FALSE; | 321 return FALSE; |
322 » » } | 322 } |
323 » } | 323 } |
324 | 324 |
325 » return FALSE; | 325 return FALSE; |
326 } | 326 } |
327 | 327 |
328 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot
* pAnnot, FX_DWORD nFlag) | 328 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot
, FX_DWORD nFlag) |
329 { | 329 { |
330 » ASSERT(pAnnot != NULL); | 330 ASSERT(pAnnot != NULL); |
331 | 331 |
332 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 332 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
333 » { | 333 { |
334 » » if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) | 334 if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) |
335 » » { | 335 { |
336 » » » return TRUE; | 336 return TRUE; |
337 » » } | 337 } |
338 » » else | 338 else |
339 » » » return FALSE; | 339 return FALSE; |
340 » } | 340 } |
341 | 341 |
342 » return FALSE; | 342 return FALSE; |
343 } | 343 } |
344 | 344 |
345 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot,CP
DFSDK_Annot* pKillAnnot) | 345 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(CPDFSDK_Annot* pSetAnnot,CP
DFSDK_Annot* pKillAnnot) |
346 { | 346 { |
347 » FX_BOOL bXFA = (pSetAnnot && pSetAnnot->GetXFAWidget()) || | 347 FX_BOOL bXFA = (pSetAnnot && pSetAnnot->GetXFAWidget()) || |
348 » » (pKillAnnot && pKillAnnot->GetXFAWidget()); | 348 (pKillAnnot && pKillAnnot->GetXFAWidget()); |
349 | 349 |
350 » if (bXFA) | 350 if (bXFA) |
351 » { | 351 { |
352 » » if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = GetAnnotHandler(FSD
K_XFAWIDGET_TYPENAME)) | 352 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = GetAnnotHandler(FSDK_XFAWID
GET_TYPENAME)) |
353 » » » return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, p
SetAnnot); | 353 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); |
354 » } | 354 } |
355 | 355 |
356 » return TRUE; | 356 return TRUE; |
357 } | 357 } |
358 | 358 |
359 CPDF_Rect» CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *p
PageView, CPDFSDK_Annot* pAnnot) | 359 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
View, CPDFSDK_Annot* pAnnot) |
360 { | 360 { |
361 » ASSERT(pAnnot); | 361 ASSERT(pAnnot); |
362 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 362 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
363 » { | 363 { |
364 » » return pAnnotHandler->GetViewBBox(pPageView, pAnnot); | 364 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); |
365 » } | 365 } |
366 » return pAnnot->GetRect(); | 366 return pAnnot->GetRect(); |
367 } | 367 } |
368 | 368 |
369 FX_BOOL»CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, const CPDF_Point& point) | 369 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, const CPDF_Point& point) |
370 { | 370 { |
371 » ASSERT(pAnnot); | 371 ASSERT(pAnnot); |
372 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 372 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
373 » { | 373 { |
374 » » if(pAnnotHandler->CanAnswer(pAnnot)) | 374 if(pAnnotHandler->CanAnswer(pAnnot)) |
375 » » » return pAnnotHandler->HitTest(pPageView, pAnnot, point); | 375 return pAnnotHandler->HitTest(pPageView, pAnnot, point); |
376 » } | 376 } |
377 » return FALSE; | 377 return FALSE; |
378 } | 378 } |
379 | 379 |
380 CPDFSDK_Annot*» CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
X_BOOL bNext) | 380 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
X_BOOL bNext) |
381 { | 381 { |
382 » CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView(); | 382 CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView(); |
383 » CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); | 383 CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage(); |
384 » if (pPage == NULL) | 384 if (pPage == NULL) |
385 » » return NULL; | 385 return NULL; |
386 » if (pPage->GetPDFPage()) { // for pdf annots. | 386 if (pPage->GetPDFPage()) { // for pdf annots. |
387 » » CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), pSDKAnnot->GetTyp
e(), ""); | 387 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), pSDKAnnot->GetType(), "")
; |
388 » » CPDFSDK_Annot* pNext = bNext ? | 388 CPDFSDK_Annot* pNext = bNext ? |
389 » » ai.GetNextAnnot(pSDKAnnot) : | 389 ai.GetNextAnnot(pSDKAnnot) : |
390 » » ai.GetPrevAnnot(pSDKAnnot); | 390 ai.GetPrevAnnot(pSDKAnnot); |
391 » » return pNext; | 391 return pNext; |
392 » } | 392 } |
393 » // for xfa annots | 393 // for xfa annots |
394 » IXFA_WidgetIterator* pWidgetIterator = pPage->GetXFAPageView()->CreateWi
dgetIterator(XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | XFA_WIDGETFIL
TER_Viewable | XFA_WIDGETFILTER_Field); | 394 IXFA_WidgetIterator* pWidgetIterator = pPage->GetXFAPageView()->CreateWidget
Iterator(XFA_TRAVERSEWAY_Tranvalse, XFA_WIDGETFILTER_Visible | XFA_WIDGETFILTER_
Viewable | XFA_WIDGETFILTER_Field); |
395 » if (pWidgetIterator == NULL) | 395 if (pWidgetIterator == NULL) |
396 » » return NULL; | 396 return NULL; |
397 » if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) | 397 if (pWidgetIterator->GetCurrentWidget() != pSDKAnnot->GetXFAWidget()) |
398 » » pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); | 398 pWidgetIterator->SetCurrentWidget(pSDKAnnot->GetXFAWidget()); |
399 » IXFA_Widget* hNextFocus = NULL; | 399 IXFA_Widget* hNextFocus = NULL; |
400 » hNextFocus = bNext?pWidgetIterator->MoveToNext():pWidgetIterator->MoveTo
Previous(); | 400 hNextFocus = bNext?pWidgetIterator->MoveToNext():pWidgetIterator->MoveToPrev
ious(); |
401 » if (hNextFocus == NULL && pSDKAnnot != NULL) | 401 if (hNextFocus == NULL && pSDKAnnot != NULL) |
402 » » hNextFocus = pWidgetIterator->MoveToFirst(); | 402 hNextFocus = pWidgetIterator->MoveToFirst(); |
403 | 403 |
404 » pWidgetIterator->Release(); | 404 pWidgetIterator->Release(); |
405 » return pPageView->GetAnnotByXFAWidget(hNextFocus); | 405 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
406 } | 406 } |
407 | 407 |
408 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) | 408 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) |
409 { | 409 { |
410 » ASSERT(pAnnot); | 410 ASSERT(pAnnot); |
411 » ASSERT(pAnnot->GetType() == "Widget"); | 411 ASSERT(pAnnot->GetType() == "Widget"); |
412 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 412 CFX_ByteString sSubType = pAnnot->GetSubType(); |
413 | 413 |
414 » if (sSubType == BFFT_SIGNATURE) | 414 if (sSubType == BFFT_SIGNATURE) |
415 » { | 415 { |
416 » } | 416 } |
417 » else | 417 else |
418 » { | 418 { |
419 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 419 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
420 » » if (!pWidget->IsVisible()) return FALSE; | 420 if (!pWidget->IsVisible()) return FALSE; |
421 | 421 |
422 » » int nFieldFlags = pWidget->GetFieldFlags(); | 422 int nFieldFlags = pWidget->GetFieldFlags(); |
423 » » if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) re
turn FALSE; | 423 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FAL
SE; |
424 » » if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 424 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
425 » » » return TRUE; | 425 return TRUE; |
426 » » else | 426 else |
427 » » { | 427 { |
428 » » » CPDF_Page* pPage = pWidget->GetPDFPage(); | 428 CPDF_Page* pPage = pWidget->GetPDFPage(); |
429 » » » ASSERT(pPage != NULL); | 429 ASSERT(pPage != NULL); |
430 | 430 |
431 » » » CPDF_Document* pDocument = pPage->m_pDocument; | 431 CPDF_Document* pDocument = pPage->m_pDocument; |
432 » » » ASSERT(pDocument != NULL); | 432 ASSERT(pDocument != NULL); |
433 | 433 |
434 » » » FX_DWORD dwPermissions = pDocument->GetUserPermissions()
; | 434 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
435 » » » return (dwPermissions&FPDFPERM_FILL_FORM) || | 435 return (dwPermissions&FPDFPERM_FILL_FORM) || |
436 » » » » (dwPermissions&FPDFPERM_ANNOT_FORM) || | 436 (dwPermissions&FPDFPERM_ANNOT_FORM) || |
437 » » » (dwPermissions&FPDFPERM_ANNOT_FORM); | 437 (dwPermissions&FPDFPERM_ANNOT_FORM); |
438 » » } | 438 } |
439 » } | 439 } |
440 | 440 |
441 » return FALSE; | 441 return FALSE; |
442 } | 442 } |
443 | 443 |
444 CPDFSDK_Annot*» » CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPD
FSDK_PageView* pPage) | 444 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Page
View* pPage) |
445 { | 445 { |
446 » ASSERT(pPage != NULL); | 446 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
447 » pPage->GetPDFDocument(); | 447 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); |
448 | 448 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInte
rForm(), pAnnot->GetAnnotDict()); |
449 » CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); | 449 if (!pCtrl) |
450 » ASSERT(pSDKDoc); | 450 return nullptr; |
451 » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterFor
m(); | 451 |
452 » ASSERT(pInterForm != NULL); | 452 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
453 | 453 pInterForm->AddMap(pCtrl, pWidget); |
454 » CPDFSDK_Widget* pWidget = NULL; | 454 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
455 » if (CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm-
>GetInterForm(), pAnnot->GetAnnotDict())) | 455 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
456 » { | 456 pWidget->ResetAppearance(nullptr, FALSE); |
457 » » pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 457 |
458 » » pInterForm->AddMap(pCtrl, pWidget); | 458 return pWidget; |
459 » » CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 459 } |
460 » » if(pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 460 |
461 » » » pWidget->ResetAppearance(NULL,FALSE); | 461 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, CPDFS
DK_PageView* pPage) |
462 » } | 462 { |
463 | 463 return NULL; |
464 » return pWidget; | |
465 } | |
466 | |
467 CPDFSDK_Annot*» » CPDFSDK_BFAnnotHandler::NewAnnot(IXFA_Widget* hWidget, C
PDFSDK_PageView* pPage) | |
468 { | |
469 » return NULL; | |
470 } | 464 } |
471 | 465 |
472 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 466 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
473 { | 467 { |
474 » ASSERT(pAnnot != NULL); | 468 ASSERT(pAnnot != NULL); |
475 | 469 |
476 » if (m_pFormFiller) | 470 if (m_pFormFiller) |
477 » » m_pFormFiller->OnDelete(pAnnot); | 471 m_pFormFiller->OnDelete(pAnnot); |
478 | 472 |
479 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 473 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
480 » CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 474 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
481 » ASSERT(pInterForm != NULL); | 475 ASSERT(pInterForm != NULL); |
482 | 476 |
483 » CPDF_FormControl* pCtrol = pWidget->GetFormControl(); | 477 CPDF_FormControl* pCtrol = pWidget->GetFormControl(); |
484 » pInterForm->RemoveMap(pCtrol); | 478 pInterForm->RemoveMap(pCtrol); |
485 | 479 |
486 | 480 |
487 » delete pWidget; | 481 delete pWidget; |
488 } | 482 } |
489 | 483 |
490 | 484 |
491 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) | 485 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) |
492 { | 486 { |
493 » ASSERT(pAnnot != NULL); | 487 ASSERT(pAnnot != NULL); |
494 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 488 CFX_ByteString sSubType = pAnnot->GetSubType(); |
495 | 489 |
496 » if (sSubType == BFFT_SIGNATURE) | 490 if (sSubType == BFFT_SIGNATURE) |
497 » { | 491 { |
498 » » ((CPDFSDK_BAAnnot*)pAnnot)->DrawAppearance(pDevice, pUser2Device
, CPDF_Annot::Normal, NULL); | 492 ((CPDFSDK_BAAnnot*)pAnnot)->DrawAppearance(pDevice, pUser2Device, CPDF_A
nnot::Normal, NULL); |
499 » } | 493 } |
500 » else | 494 else |
501 » { | 495 { |
502 » » if (m_pFormFiller) | 496 if (m_pFormFiller) |
503 » » { | 497 { |
504 » » » m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2
Device, dwFlags); | 498 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFl
ags); |
505 » » } | 499 } |
506 » } | 500 } |
507 } | 501 } |
508 | 502 |
509 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlag) | 503 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlag) |
510 { | 504 { |
511 » ASSERT(pAnnot != NULL); | 505 ASSERT(pAnnot != NULL); |
512 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 506 CFX_ByteString sSubType = pAnnot->GetSubType(); |
513 | 507 |
514 » if (sSubType == BFFT_SIGNATURE) | 508 if (sSubType == BFFT_SIGNATURE) |
515 » { | 509 { |
516 » } | 510 } |
517 » else | 511 else |
518 » { | 512 { |
519 » » if (m_pFormFiller) | 513 if (m_pFormFiller) |
520 » » » m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); | 514 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); |
521 » } | 515 } |
522 | 516 |
523 | 517 |
524 } | 518 } |
525 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlag) | 519 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlag) |
526 { | 520 { |
527 » ASSERT(pAnnot != NULL); | 521 ASSERT(pAnnot != NULL); |
528 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 522 CFX_ByteString sSubType = pAnnot->GetSubType(); |
529 | 523 |
530 » if (sSubType == BFFT_SIGNATURE) | 524 if (sSubType == BFFT_SIGNATURE) |
531 » { | 525 { |
532 » } | 526 } |
533 » else | 527 else |
534 » { | 528 { |
535 » » if (m_pFormFiller) | 529 if (m_pFormFiller) |
536 » » » m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); | 530 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); |
537 » } | 531 } |
538 | 532 |
539 } | 533 } |
540 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 534 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
541 { | 535 { |
542 » ASSERT(pAnnot != NULL); | 536 ASSERT(pAnnot != NULL); |
543 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 537 CFX_ByteString sSubType = pAnnot->GetSubType(); |
544 | 538 |
545 » if (sSubType == BFFT_SIGNATURE) | 539 if (sSubType == BFFT_SIGNATURE) |
546 » { | 540 { |
547 » } | 541 } |
548 » else | 542 else |
549 » { | 543 { |
550 » » if (m_pFormFiller) | 544 if (m_pFormFiller) |
551 » » » return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, n
Flags, point); | 545 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point
); |
552 » } | 546 } |
553 | 547 |
554 » return FALSE; | 548 return FALSE; |
555 } | 549 } |
556 | 550 |
557 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 551 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
558 { | 552 { |
559 » ASSERT(pAnnot != NULL); | 553 ASSERT(pAnnot != NULL); |
560 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 554 CFX_ByteString sSubType = pAnnot->GetSubType(); |
561 | 555 |
562 » if (sSubType == BFFT_SIGNATURE) | 556 if (sSubType == BFFT_SIGNATURE) |
563 » { | 557 { |
564 » } | 558 } |
565 » else | 559 else |
566 » { | 560 { |
567 » » if (m_pFormFiller) | 561 if (m_pFormFiller) |
568 » » » return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFl
ags, point); | 562 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
569 » } | 563 } |
570 | 564 |
571 » return FALSE; | 565 return FALSE; |
572 } | 566 } |
573 | 567 |
574 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD
FSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 568 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD
FSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
575 { | 569 { |
576 » ASSERT(pAnnot != NULL); | 570 ASSERT(pAnnot != NULL); |
577 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 571 CFX_ByteString sSubType = pAnnot->GetSubType(); |
578 | 572 |
579 » if (sSubType == BFFT_SIGNATURE) | 573 if (sSubType == BFFT_SIGNATURE) |
580 » { | 574 { |
581 » } | 575 } |
582 » else | 576 else |
583 » { | 577 { |
584 » » if (m_pFormFiller) | 578 if (m_pFormFiller) |
585 » » » return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot,
nFlags, point); | 579 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, poi
nt); |
586 » } | 580 } |
587 | 581 |
588 » return FALSE; | 582 return FALSE; |
589 } | 583 } |
590 | 584 |
591 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 585 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
592 { | 586 { |
593 » ASSERT(pAnnot != NULL); | 587 ASSERT(pAnnot != NULL); |
594 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 588 CFX_ByteString sSubType = pAnnot->GetSubType(); |
595 | 589 |
596 » if (sSubType == BFFT_SIGNATURE) | 590 if (sSubType == BFFT_SIGNATURE) |
597 » { | 591 { |
598 » } | 592 } |
599 » else | 593 else |
600 » { | 594 { |
601 » » if (m_pFormFiller) | 595 if (m_pFormFiller) |
602 » » » return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFl
ags, point); | 596 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
603 » } | 597 } |
604 | 598 |
605 » return FALSE; | 599 return FALSE; |
606 | 600 |
607 } | 601 } |
608 | 602 |
609 | 603 |
610 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 604 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
611 { | 605 { |
612 » ASSERT(pAnnot != NULL); | 606 ASSERT(pAnnot != NULL); |
613 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 607 CFX_ByteString sSubType = pAnnot->GetSubType(); |
614 | 608 |
615 » if (sSubType == BFFT_SIGNATURE) | 609 if (sSubType == BFFT_SIGNATURE) |
616 » { | 610 { |
617 » } | 611 } |
618 » else | 612 else |
619 » { | 613 { |
620 » » if (m_pFormFiller) | 614 if (m_pFormFiller) |
621 » » » return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nF
lags, zDelta,point); | 615 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta
,point); |
622 » } | 616 } |
623 | 617 |
624 » return FALSE; | 618 return FALSE; |
625 } | 619 } |
626 | 620 |
627 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 621 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
628 { | 622 { |
629 » ASSERT(pAnnot != NULL); | 623 ASSERT(pAnnot != NULL); |
630 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 624 CFX_ByteString sSubType = pAnnot->GetSubType(); |
631 | 625 |
632 » if (sSubType == BFFT_SIGNATURE) | 626 if (sSubType == BFFT_SIGNATURE) |
633 » { | 627 { |
634 » } | 628 } |
635 » else | 629 else |
636 » { | 630 { |
637 » » if (m_pFormFiller) | 631 if (m_pFormFiller) |
638 » » » return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, n
Flags, point); | 632 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point
); |
639 » } | 633 } |
640 | 634 |
641 » return FALSE; | 635 return FALSE; |
642 } | 636 } |
643 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 637 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
644 { | 638 { |
645 » ASSERT(pAnnot != NULL); | 639 ASSERT(pAnnot != NULL); |
646 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 640 CFX_ByteString sSubType = pAnnot->GetSubType(); |
647 | 641 |
648 » if (sSubType == BFFT_SIGNATURE) | 642 if (sSubType == BFFT_SIGNATURE) |
649 » { | 643 { |
650 » } | 644 } |
651 » else | 645 else |
652 » { | 646 { |
653 » » if (m_pFormFiller) | 647 if (m_pFormFiller) |
654 » » » return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFl
ags, point); | 648 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
655 » } | 649 } |
656 | 650 |
657 » return FALSE; | 651 return FALSE; |
658 } | 652 } |
659 | 653 |
660 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX
_DWORD nFlags) | 654 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX
_DWORD nFlags) |
661 { | 655 { |
662 » ASSERT(pAnnot != NULL); | 656 ASSERT(pAnnot != NULL); |
663 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 657 CFX_ByteString sSubType = pAnnot->GetSubType(); |
664 | 658 |
665 » if (sSubType == BFFT_SIGNATURE) | 659 if (sSubType == BFFT_SIGNATURE) |
666 » { | 660 { |
667 » } | 661 } |
668 » else | 662 else |
669 » { | 663 { |
670 » » if (m_pFormFiller) | 664 if (m_pFormFiller) |
671 » » » return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); | 665 return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); |
672 » } | 666 } |
673 | 667 |
674 » return FALSE; | 668 return FALSE; |
675 } | 669 } |
676 | 670 |
677 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i
nt nFlag) | 671 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i
nt nFlag) |
678 { | 672 { |
679 » ASSERT(pAnnot != NULL); | 673 ASSERT(pAnnot != NULL); |
680 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 674 CFX_ByteString sSubType = pAnnot->GetSubType(); |
681 | 675 |
682 » if (sSubType == BFFT_SIGNATURE) | 676 if (sSubType == BFFT_SIGNATURE) |
683 » { | 677 { |
684 » } | 678 } |
685 » else | 679 else |
686 » { | 680 { |
687 » » if (m_pFormFiller) | 681 if (m_pFormFiller) |
688 » » » return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); | 682 return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); |
689 » } | 683 } |
690 | 684 |
691 » return FALSE; | 685 return FALSE; |
692 } | 686 } |
693 | 687 |
694 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) | 688 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) |
695 { | 689 { |
696 | 690 |
697 » return FALSE; | 691 return FALSE; |
698 } | 692 } |
699 void» CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) | 693 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) |
700 { | 694 { |
701 » ASSERT(pAnnot != NULL); | 695 ASSERT(pAnnot != NULL); |
702 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 696 CFX_ByteString sSubType = pAnnot->GetSubType(); |
703 | 697 |
704 » if (sSubType == BFFT_SIGNATURE) | 698 if (sSubType == BFFT_SIGNATURE) |
705 » { | 699 { |
706 » } | 700 } |
707 » else | 701 else |
708 » { | 702 { |
709 » » if (m_pFormFiller) | 703 if (m_pFormFiller) |
710 » » » m_pFormFiller->OnCreate(pAnnot); | 704 m_pFormFiller->OnCreate(pAnnot); |
711 » } | 705 } |
712 } | 706 } |
713 | 707 |
714 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) | 708 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) |
715 { | 709 { |
716 » ASSERT(pAnnot != NULL); | 710 ASSERT(pAnnot != NULL); |
717 | 711 |
718 » CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 712 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
719 » ASSERT(pPageView != NULL); | 713 ASSERT(pPageView != NULL); |
720 | 714 |
721 » CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 715 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
722 » ASSERT(pSDKDoc != NULL); | 716 ASSERT(pSDKDoc != NULL); |
723 | 717 |
724 » CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 718 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
725 » ASSERT(pDoc != NULL); | 719 ASSERT(pDoc != NULL); |
726 | 720 |
727 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 721 CFX_ByteString sSubType = pAnnot->GetSubType(); |
728 | 722 |
729 » if (sSubType == BFFT_SIGNATURE) | 723 if (sSubType == BFFT_SIGNATURE) |
730 » { | 724 { |
731 » } | 725 } |
732 » else | 726 else |
733 » { | 727 { |
734 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 728 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
735 » » if (!pWidget->IsAppearanceValid()) | 729 if (!pWidget->IsAppearanceValid()) |
736 » » » pWidget->ResetAppearance(NULL, FALSE); | 730 pWidget->ResetAppearance(NULL, FALSE); |
737 | 731 |
738 » » int nFieldType = pWidget->GetFieldType(); | 732 int nFieldType = pWidget->GetFieldType(); |
739 » » if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE
_COMBOBOX) | 733 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBO
X) |
740 » » { | 734 { |
741 » » » FX_BOOL bFormated = FALSE; | 735 FX_BOOL bFormated = FALSE; |
742 » » » CFX_WideString sValue = pWidget->OnFormat(bFormated); | 736 CFX_WideString sValue = pWidget->OnFormat(bFormated); |
743 » » » if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) | 737 if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) |
744 » » » { | 738 { |
745 » » » » pWidget->ResetAppearance(sValue.c_str(), FALSE); | 739 pWidget->ResetAppearance(sValue.c_str(), FALSE); |
746 » » » } | 740 } |
747 » » } | 741 } |
748 | 742 |
749 » » if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) | 743 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) |
750 » » { | 744 { |
751 » » » if (!pWidget->IsAppearanceValid() && !pWidget->GetValue(
).IsEmpty()) | 745 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) |
752 » » » » pWidget->ResetAppearance(FALSE); | 746 pWidget->ResetAppearance(FALSE); |
753 » » } | 747 } |
754 | 748 |
755 | 749 |
756 » » if (m_pFormFiller) | 750 if (m_pFormFiller) |
757 » » » m_pFormFiller->OnLoad(pAnnot); | 751 m_pFormFiller->OnLoad(pAnnot); |
758 » } | 752 } |
759 } | 753 } |
760 | 754 |
761 FX_BOOL»CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag
) | 755 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag
) |
762 { | 756 { |
763 » ASSERT(pAnnot != NULL); | 757 ASSERT(pAnnot != NULL); |
764 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 758 CFX_ByteString sSubType = pAnnot->GetSubType(); |
765 | 759 |
766 » if (sSubType == BFFT_SIGNATURE) | 760 if (sSubType == BFFT_SIGNATURE) |
767 » { | 761 { |
768 » } | 762 } |
769 » else | 763 else |
770 » { | 764 { |
771 » » if (m_pFormFiller) | 765 if (m_pFormFiller) |
772 » » » return m_pFormFiller->OnSetFocus(pAnnot,nFlag); | 766 return m_pFormFiller->OnSetFocus(pAnnot,nFlag); |
773 » } | 767 } |
774 | 768 |
775 » return TRUE; | 769 return TRUE; |
776 } | 770 } |
777 FX_BOOL»CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) | 771 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) |
778 { | 772 { |
779 » ASSERT(pAnnot != NULL); | 773 ASSERT(pAnnot != NULL); |
780 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 774 CFX_ByteString sSubType = pAnnot->GetSubType(); |
781 | 775 |
782 » if (sSubType == BFFT_SIGNATURE) | 776 if (sSubType == BFFT_SIGNATURE) |
783 » { | 777 { |
784 » } | 778 } |
785 » else | 779 else |
786 » { | 780 { |
787 » » if (m_pFormFiller) | 781 if (m_pFormFiller) |
788 » » » return m_pFormFiller->OnKillFocus(pAnnot,nFlag); | 782 return m_pFormFiller->OnKillFocus(pAnnot,nFlag); |
789 » } | 783 } |
790 | 784 |
791 » return TRUE; | 785 return TRUE; |
792 } | 786 } |
793 | 787 |
794 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) | 788 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) |
795 { | 789 { |
796 » ASSERT(pAnnot != NULL); | 790 ASSERT(pAnnot != NULL); |
797 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 791 CFX_ByteString sSubType = pAnnot->GetSubType(); |
798 | 792 |
799 » if (sSubType == BFFT_SIGNATURE) | 793 if (sSubType == BFFT_SIGNATURE) |
800 » { | 794 { |
801 » } | 795 } |
802 » else | 796 else |
803 » { | 797 { |
804 » » if (m_pFormFiller) | 798 if (m_pFormFiller) |
805 » » » return m_pFormFiller->GetViewBBox(pPageView, pAnnot); | 799 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); |
806 | 800 |
807 » } | 801 } |
808 | 802 |
809 » return CPDF_Rect(0,0,0,0); | 803 return CPDF_Rect(0,0,0,0); |
810 } | 804 } |
811 | 805 |
812 FX_BOOL»CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Ann
ot* pAnnot, const CPDF_Point& point) | 806 FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Ann
ot* pAnnot, const CPDF_Point& point) |
813 { | 807 { |
814 » ASSERT(pPageView); | 808 ASSERT(pPageView); |
815 » ASSERT(pAnnot); | 809 ASSERT(pAnnot); |
816 | 810 |
817 » CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); | 811 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); |
818 » return rect.Contains(point.x, point.y); | 812 return rect.Contains(point.x, point.y); |
819 } | 813 } |
820 | 814 |
821 //CPDFSDK_XFAAnnotHandler | 815 //CPDFSDK_XFAAnnotHandler |
822 | 816 |
823 #define FWL_WGTHITTEST_Unknown» » » 0 | 817 #define FWL_WGTHITTEST_Unknown 0 |
824 #define FWL_WGTHITTEST_Client» » » 1 //arrow | 818 #define FWL_WGTHITTEST_Client 1 //arrow |
825 #define FWL_WGTHITTEST_Titlebar»» » 11 //caption | 819 #define FWL_WGTHITTEST_Titlebar 11 //caption |
826 #define FWL_WGTHITTEST_HScrollBar» » 15 | 820 #define FWL_WGTHITTEST_HScrollBar 15 |
827 #define FWL_WGTHITTEST_VScrollBar» » 16 | 821 #define FWL_WGTHITTEST_VScrollBar 16 |
828 #define FWL_WGTHITTEST_Border» » » 17 | 822 #define FWL_WGTHITTEST_Border 17 |
829 #define FWL_WGTHITTEST_Edit» » » » 19 | 823 #define FWL_WGTHITTEST_Edit 19 |
830 #define FWL_WGTHITTEST_HyperLink 20 | 824 #define FWL_WGTHITTEST_HyperLink 20 |
831 | 825 |
832 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) : | 826 CPDFSDK_XFAAnnotHandler::CPDFSDK_XFAAnnotHandler(CPDFDoc_Environment* pApp) : |
833 » m_pApp(pApp) | 827 m_pApp(pApp) |
834 { | 828 { |
835 | 829 |
836 } | 830 } |
837 | 831 |
838 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_Pa
geView* pPage) | 832 CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(IXFA_Widget* pAnnot, CPDFSDK_Pa
geView* pPage) |
839 { | 833 { |
840 » ASSERT(pPage != NULL); | 834 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
841 » ASSERT(pAnnot != NULL); | 835 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); |
842 | 836 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm
); |
843 » CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); | 837 pInterForm->AddXFAMap(pAnnot, pWidget); |
844 » ASSERT(pSDKDoc); | 838 return pWidget; |
845 » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterFor
m(); | |
846 » ASSERT(pInterForm != NULL); | |
847 | |
848 » CPDFSDK_XFAWidget* pWidget = NULL; | |
849 » pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); | |
850 » ASSERT(pWidget != NULL); | |
851 » pInterForm->AddXFAMap(pAnnot, pWidget); | |
852 | |
853 » return pWidget; | |
854 } | 839 } |
855 | 840 |
856 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) | 841 FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) |
857 { | 842 { |
858 » ASSERT(pAnnot != NULL); | 843 return pAnnot->GetXFAWidget() != NULL; |
859 | |
860 » return pAnnot->GetXFAWidget() != NULL; | |
861 } | 844 } |
862 | 845 |
863 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) | 846 void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) |
864 { | 847 { |
865 » ASSERT(pPageView != NULL); | 848 ASSERT(pPageView != NULL); |
866 » ASSERT(pAnnot != NULL); | 849 ASSERT(pAnnot != NULL); |
867 | 850 |
868 » CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 851 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
869 » ASSERT(pSDKDoc != NULL); | 852 ASSERT(pSDKDoc != NULL); |
870 | 853 |
871 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 854 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
872 » ASSERT(pWidgetHandler != NULL); | 855 ASSERT(pWidgetHandler != NULL); |
873 | 856 |
874 » CFX_Graphics gs; | 857 CFX_Graphics gs; |
875 » gs.Create(pDevice); | 858 gs.Create(pDevice); |
876 | 859 |
877 » CFX_Matrix mt; | 860 CFX_Matrix mt; |
878 » mt = *(CFX_Matrix*)pUser2Device; | 861 mt = *(CFX_Matrix*)pUser2Device; |
879 | 862 |
880 » IXFA_Widget* hWidget = pAnnot->GetXFAWidget(); | 863 IXFA_Widget* hWidget = pAnnot->GetXFAWidget(); |
881 » ASSERT(hWidget != NULL); | 864 ASSERT(hWidget != NULL); |
882 | 865 |
883 » FX_BOOL bIsHighlight = FALSE; | 866 FX_BOOL bIsHighlight = FALSE; |
884 » if (pSDKDoc->GetFocusAnnot() != pAnnot) | 867 if (pSDKDoc->GetFocusAnnot() != pAnnot) |
885 » » bIsHighlight = TRUE; | 868 bIsHighlight = TRUE; |
886 | 869 |
887 » pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighli
ght); | 870 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight)
; |
888 | 871 |
889 » // to do highlight and shadow | 872 // to do highlight and shadow |
890 | 873 |
891 } | 874 } |
892 | 875 |
893 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 876 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
894 { | 877 { |
895 » ASSERT(pAnnot != NULL); | 878 ASSERT(pAnnot != NULL); |
896 | 879 |
897 » CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; | 880 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; |
898 » CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 881 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
899 » ASSERT(pInterForm != NULL); | 882 ASSERT(pInterForm != NULL); |
900 | 883 |
901 » pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); | 884 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); |
902 | 885 |
903 » delete pWidget; | 886 delete pWidget; |
904 } | 887 } |
905 | 888 |
906 CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDF
SDK_Annot* pAnnot) | 889 CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDF
SDK_Annot* pAnnot) |
907 { | 890 { |
908 » ASSERT(pAnnot != NULL); | 891 ASSERT(pAnnot != NULL); |
909 | 892 |
910 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 893 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
911 » ASSERT(pWidgetHandler != NULL); | 894 ASSERT(pWidgetHandler != NULL); |
912 | 895 |
913 » XFA_ELEMENT eType = pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->
GetUIType(); | 896 XFA_ELEMENT eType = pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetU
IType(); |
914 » CFX_RectF rcBBox; | 897 CFX_RectF rcBBox; |
915 » if (eType == XFA_ELEMENT_Signature) | 898 if (eType == XFA_ELEMENT_Signature) |
916 » » pWidgetHandler->GetBBox (pAnnot->GetXFAWidget(), rcBBox, XFA_WID
GETSTATUS_Visible, TRUE); | 899 pWidgetHandler->GetBBox (pAnnot->GetXFAWidget(), rcBBox, XFA_WIDGETSTATU
S_Visible, TRUE); |
917 » else | 900 else |
918 » » pWidgetHandler->GetBBox (pAnnot->GetXFAWidget(), rcBBox, 0); | 901 pWidgetHandler->GetBBox (pAnnot->GetXFAWidget(), rcBBox, 0); |
919 | 902 |
920 » CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.wid
th, rcBBox.top+rcBBox.height); | 903 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
rcBBox.top+rcBBox.height); |
921 » rcWidget.left -= 1.0f; | 904 rcWidget.left -= 1.0f; |
922 » rcWidget.right += 1.0f; | 905 rcWidget.right += 1.0f; |
923 » rcWidget.bottom -= 1.0f; | 906 rcWidget.bottom -= 1.0f; |
924 » rcWidget.top += 1.0f; | 907 rcWidget.top += 1.0f; |
925 | 908 |
926 » return rcWidget; | 909 return rcWidget; |
927 } | 910 } |
928 | 911 |
929 FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, const CPDF_Point& point) | 912 FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, const CPDF_Point& point) |
930 { | 913 { |
931 » if (!pPageView || !pAnnot) | 914 if (!pPageView || !pAnnot) |
932 » » return FALSE; | 915 return FALSE; |
933 | 916 |
934 » CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 917 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
935 » if (!pSDKDoc) | 918 if (!pSDKDoc) |
936 » » return FALSE; | 919 return FALSE; |
937 | 920 |
938 » CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 921 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
939 » if (!pDoc) | 922 if (!pDoc) |
940 » » return FALSE; | 923 return FALSE; |
941 | 924 |
942 » IXFA_DocView* pDocView = pDoc->GetXFADocView(); | 925 IXFA_DocView* pDocView = pDoc->GetXFADocView(); |
943 » if (!pDocView) | 926 if (!pDocView) |
944 » » return FALSE; | 927 return FALSE; |
945 | 928 |
946 » IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); | 929 IXFA_WidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); |
947 » if (!pWidgetHandler) | 930 if (!pWidgetHandler) |
948 » » return FALSE; | 931 return FALSE; |
949 | 932 |
950 » FX_DWORD dwHitTest = pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), p
oint.x, point.y); | 933 FX_DWORD dwHitTest = pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point
.x, point.y); |
951 » return (dwHitTest != FWL_WGTHITTEST_Unknown); | 934 return (dwHitTest != FWL_WGTHITTEST_Unknown); |
952 } | 935 } |
953 | 936 |
954 void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_
Annot* pAnnot, FX_DWORD nFlag) | 937 void CPDFSDK_XFAAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_
Annot* pAnnot, FX_DWORD nFlag) |
955 { | 938 { |
956 » if (!pPageView || !pAnnot) | 939 if (!pPageView || !pAnnot) |
957 » » return; | 940 return; |
958 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 941 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
959 » ASSERT(pWidgetHandler != NULL); | 942 ASSERT(pWidgetHandler != NULL); |
960 | 943 |
961 » pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget()); | 944 pWidgetHandler->OnMouseEnter(pAnnot->GetXFAWidget()); |
962 } | 945 } |
963 | 946 |
964 void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlag) | 947 void CPDFSDK_XFAAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlag) |
965 { | 948 { |
966 » if (!pPageView || !pAnnot) | 949 if (!pPageView || !pAnnot) |
967 » » return; | 950 return; |
968 | 951 |
969 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 952 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
970 » ASSERT(pWidgetHandler != NULL); | 953 ASSERT(pWidgetHandler != NULL); |
971 | 954 |
972 » pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); | 955 pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); |
973 } | 956 } |
974 | 957 |
975 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDF
SDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 958 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDF
SDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
976 { | 959 { |
977 » if (!pPageView || !pAnnot) | 960 if (!pPageView || !pAnnot) |
978 » » return FALSE; | 961 return FALSE; |
979 | 962 |
980 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 963 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
981 » ASSERT(pWidgetHandler != NULL); | 964 ASSERT(pWidgetHandler != NULL); |
982 | 965 |
983 » FX_BOOL bRet = FALSE; | 966 FX_BOOL bRet = FALSE; |
984 » bRet = pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), GetFWLFlags
(nFlags), point.x, point.y); | 967 bRet = pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), GetFWLFlags(nFl
ags), point.x, point.y); |
985 | 968 |
986 » return bRet; | 969 return bRet; |
987 } | 970 } |
988 | 971 |
989 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 972 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
990 { | 973 { |
991 » if (!pPageView || !pAnnot) | 974 if (!pPageView || !pAnnot) |
992 » » return FALSE; | 975 return FALSE; |
993 | 976 |
994 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 977 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
995 » ASSERT(pWidgetHandler != NULL); | 978 ASSERT(pWidgetHandler != NULL); |
996 | 979 |
997 » FX_BOOL bRet = FALSE; | 980 FX_BOOL bRet = FALSE; |
998 » bRet = pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), GetFWLFlags(n
Flags), point.x, point.y); | 981 bRet = pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), GetFWLFlags(nFlag
s), point.x, point.y); |
999 | 982 |
1000 » return bRet; | 983 return bRet; |
1001 } | 984 } |
1002 | 985 |
1003 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 986 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
1004 { | 987 { |
1005 » if (!pPageView || !pAnnot) | 988 if (!pPageView || !pAnnot) |
1006 » » return FALSE; | 989 return FALSE; |
1007 | 990 |
1008 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 991 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1009 » ASSERT(pWidgetHandler != NULL); | 992 ASSERT(pWidgetHandler != NULL); |
1010 | 993 |
1011 » FX_BOOL bRet = FALSE; | 994 FX_BOOL bRet = FALSE; |
1012 » bRet = pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), GetFWLFla
gs(nFlags), point.x, point.y); | 995 bRet = pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), GetFWLFlags(n
Flags), point.x, point.y); |
1013 | 996 |
1014 » return bRet; | 997 return bRet; |
1015 } | 998 } |
1016 | 999 |
1017 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 1000 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
1018 { | 1001 { |
1019 » if (!pPageView || !pAnnot) | 1002 if (!pPageView || !pAnnot) |
1020 » » return FALSE; | 1003 return FALSE; |
1021 | 1004 |
1022 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1005 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1023 » ASSERT(pWidgetHandler != NULL); | 1006 ASSERT(pWidgetHandler != NULL); |
1024 | 1007 |
1025 » FX_BOOL bRet = FALSE; | 1008 FX_BOOL bRet = FALSE; |
1026 » bRet = pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), GetFWLFlags(n
Flags), point.x, point.y); | 1009 bRet = pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), GetFWLFlags(nFlag
s), point.x, point.y); |
1027 | 1010 |
1028 » return bRet; | 1011 return bRet; |
1029 } | 1012 } |
1030 | 1013 |
1031 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 1014 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
1032 { | 1015 { |
1033 » if (!pPageView || !pAnnot) | 1016 if (!pPageView || !pAnnot) |
1034 » » return FALSE; | 1017 return FALSE; |
1035 | 1018 |
1036 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1019 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1037 » ASSERT(pWidgetHandler != NULL); | 1020 ASSERT(pWidgetHandler != NULL); |
1038 | 1021 |
1039 » FX_BOOL bRet = FALSE; | 1022 FX_BOOL bRet = FALSE; |
1040 » bRet = pWidgetHandler->OnMouseWheel(pAnnot->GetXFAWidget(), GetFWLFlags(
nFlags), zDelta, point.x, point.y); | 1023 bRet = pWidgetHandler->OnMouseWheel(pAnnot->GetXFAWidget(), GetFWLFlags(nFla
gs), zDelta, point.x, point.y); |
1041 | 1024 |
1042 » return bRet; | 1025 return bRet; |
1043 } | 1026 } |
1044 | 1027 |
1045 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDF
SDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 1028 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDF
SDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
1046 { | 1029 { |
1047 » if (!pPageView || !pAnnot) | 1030 if (!pPageView || !pAnnot) |
1048 » » return FALSE; | 1031 return FALSE; |
1049 | 1032 |
1050 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1033 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1051 » ASSERT(pWidgetHandler != NULL); | 1034 ASSERT(pWidgetHandler != NULL); |
1052 | 1035 |
1053 » FX_BOOL bRet = FALSE; | 1036 FX_BOOL bRet = FALSE; |
1054 » bRet = pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), GetFWLFlags
(nFlags), point.x, point.y); | 1037 bRet = pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), GetFWLFlags(nFl
ags), point.x, point.y); |
1055 | 1038 |
1056 » return bRet; | 1039 return bRet; |
1057 } | 1040 } |
1058 | 1041 |
1059 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 1042 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
1060 { | 1043 { |
1061 » if (!pPageView || !pAnnot) | 1044 if (!pPageView || !pAnnot) |
1062 » » return FALSE; | 1045 return FALSE; |
1063 | 1046 |
1064 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1047 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1065 » ASSERT(pWidgetHandler != NULL); | 1048 ASSERT(pWidgetHandler != NULL); |
1066 | 1049 |
1067 » FX_BOOL bRet = FALSE; | 1050 FX_BOOL bRet = FALSE; |
1068 » bRet = pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), GetFWLFlags(n
Flags), point.x, point.y); | 1051 bRet = pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), GetFWLFlags(nFlag
s), point.x, point.y); |
1069 | 1052 |
1070 » return bRet; | 1053 return bRet; |
1071 } | 1054 } |
1072 | 1055 |
1073 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 1056 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
1074 { | 1057 { |
1075 » if (!pPageView || !pAnnot) | 1058 if (!pPageView || !pAnnot) |
1076 » » return FALSE; | 1059 return FALSE; |
1077 | 1060 |
1078 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1061 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1079 » ASSERT(pWidgetHandler != NULL); | 1062 ASSERT(pWidgetHandler != NULL); |
1080 | 1063 |
1081 » FX_BOOL bRet = FALSE; | 1064 FX_BOOL bRet = FALSE; |
1082 » bRet = pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), GetFWLFla
gs(nFlags), point.x, point.y); | 1065 bRet = pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), GetFWLFlags(n
Flags), point.x, point.y); |
1083 | 1066 |
1084 » return bRet; | 1067 return bRet; |
1085 } | 1068 } |
1086 | 1069 |
1087 FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, F
X_DWORD nFlags) | 1070 FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, F
X_DWORD nFlags) |
1088 { | 1071 { |
1089 » if (!pAnnot) | 1072 if (!pAnnot) |
1090 » » return FALSE; | 1073 return FALSE; |
1091 | 1074 |
1092 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1075 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1093 » ASSERT(pWidgetHandler != NULL); | 1076 ASSERT(pWidgetHandler != NULL); |
1094 | 1077 |
1095 » FX_BOOL bRet = FALSE; | 1078 FX_BOOL bRet = FALSE; |
1096 » bRet = pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar, GetFWLFlags
(nFlags)); | 1079 bRet = pWidgetHandler->OnChar(pAnnot->GetXFAWidget(), nChar, GetFWLFlags(nFl
ags)); |
1097 | 1080 |
1098 » return bRet; | 1081 return bRet; |
1099 } | 1082 } |
1100 | 1083 |
1101 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode,
int nFlag) | 1084 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode,
int nFlag) |
1102 { | 1085 { |
1103 » if (!pAnnot) | 1086 if (!pAnnot) |
1104 » » return FALSE; | 1087 return FALSE; |
1105 | 1088 |
1106 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1089 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1107 » ASSERT(pWidgetHandler != NULL); | 1090 ASSERT(pWidgetHandler != NULL); |
1108 | 1091 |
1109 » FX_BOOL bRet = FALSE; | 1092 FX_BOOL bRet = FALSE; |
1110 » bRet = pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode, GetFW
LFlags(nFlag)); | 1093 bRet = pWidgetHandler->OnKeyDown(pAnnot->GetXFAWidget(), nKeyCode, GetFWLFla
gs(nFlag)); |
1111 | 1094 |
1112 » return bRet; | 1095 return bRet; |
1113 } | 1096 } |
1114 | 1097 |
1115 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, in
t nFlag) | 1098 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, in
t nFlag) |
1116 { | 1099 { |
1117 » if (!pAnnot) | 1100 if (!pAnnot) |
1118 » » return FALSE; | 1101 return FALSE; |
1119 | 1102 |
1120 » IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 1103 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
1121 » ASSERT(pWidgetHandler != NULL); | 1104 ASSERT(pWidgetHandler != NULL); |
1122 | 1105 |
1123 » FX_BOOL bRet = FALSE; | 1106 FX_BOOL bRet = FALSE; |
1124 » bRet = pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode, GetFWLF
lags(nFlag)); | 1107 bRet = pWidgetHandler->OnKeyUp(pAnnot->GetXFAWidget(), nKeyCode, GetFWLFlags
(nFlag)); |
1125 | 1108 |
1126 » return bRet; | 1109 return bRet; |
1127 } | 1110 } |
1128 | 1111 |
1129 FX_BOOL CPDFSDK_XFAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) | 1112 FX_BOOL CPDFSDK_XFAAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) |
1130 { | 1113 { |
1131 » return TRUE; | 1114 return TRUE; |
1132 } | 1115 } |
1133 | 1116 |
1134 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFl
ag) | 1117 FX_BOOL CPDFSDK_XFAAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFl
ag) |
1135 { | 1118 { |
1136 » return TRUE; | 1119 return TRUE; |
1137 } | 1120 } |
1138 | 1121 |
1139 FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPD
FSDK_Annot* pNewAnnot) | 1122 FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, CPD
FSDK_Annot* pNewAnnot) |
1140 { | 1123 { |
1141 » IXFA_WidgetHandler* pWidgetHandler = NULL; | 1124 IXFA_WidgetHandler* pWidgetHandler = NULL; |
1142 | 1125 |
1143 » if (pOldAnnot) | 1126 if (pOldAnnot) |
1144 » » pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); | 1127 pWidgetHandler = GetXFAWidgetHandler(pOldAnnot); |
1145 » else if (pNewAnnot) | 1128 else if (pNewAnnot) |
1146 » » pWidgetHandler = GetXFAWidgetHandler(pNewAnnot); | 1129 pWidgetHandler = GetXFAWidgetHandler(pNewAnnot); |
1147 | 1130 |
1148 » if (pWidgetHandler) | 1131 if (pWidgetHandler) |
1149 » { | 1132 { |
1150 » » FX_BOOL bRet = TRUE; | 1133 FX_BOOL bRet = TRUE; |
1151 » » IXFA_Widget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : N
ULL; | 1134 IXFA_Widget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL; |
1152 » » if (hWidget) | 1135 if (hWidget) |
1153 » » { | 1136 { |
1154 » » » IXFA_PageView* pXFAPageView = pWidgetHandler->GetPageVie
w(hWidget); | 1137 IXFA_PageView* pXFAPageView = pWidgetHandler->GetPageView(hWidget); |
1155 » » » if (pXFAPageView) | 1138 if (pXFAPageView) |
1156 » » » { | 1139 { |
1157 » » » » bRet = pXFAPageView->GetDocView()->SetFocus(hWid
get); | 1140 bRet = pXFAPageView->GetDocView()->SetFocus(hWidget); |
1158 » » » » if (pXFAPageView->GetDocView()->GetFocusWidget()
== hWidget) | 1141 if (pXFAPageView->GetDocView()->GetFocusWidget() == hWidget) |
1159 » » » » » bRet = TRUE; | 1142 bRet = TRUE; |
1160 » » » } | 1143 } |
1161 » » } | 1144 } |
1162 » » return bRet; | 1145 return bRet; |
1163 » } | 1146 } |
1164 | 1147 |
1165 » return TRUE; | 1148 return TRUE; |
1166 } | 1149 } |
1167 | 1150 |
1168 IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(CPDFSDK_Annot*
pAnnot) | 1151 IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(CPDFSDK_Annot*
pAnnot) |
1169 { | 1152 { |
1170 » if (!pAnnot) | 1153 if (!pAnnot) |
1171 » » return NULL; | 1154 return NULL; |
1172 | 1155 |
1173 » CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 1156 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
1174 » if (!pPageView) | 1157 if (!pPageView) |
1175 » » return NULL; | 1158 return NULL; |
1176 | 1159 |
1177 » CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 1160 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
1178 » if (!pSDKDoc) | 1161 if (!pSDKDoc) |
1179 » » return NULL; | 1162 return NULL; |
1180 | 1163 |
1181 » CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); | 1164 CPDFXFA_Document* pDoc = pSDKDoc->GetDocument(); |
1182 » if (!pDoc) | 1165 if (!pDoc) |
1183 » » return NULL; | 1166 return NULL; |
1184 | 1167 |
1185 » IXFA_DocView* pDocView = pDoc->GetXFADocView(); | 1168 IXFA_DocView* pDocView = pDoc->GetXFADocView(); |
1186 » if (!pDocView) | 1169 if (!pDocView) |
1187 » » return NULL; | 1170 return NULL; |
1188 | 1171 |
1189 » return pDocView->GetWidgetHandler(); | 1172 return pDocView->GetWidgetHandler(); |
1190 } | 1173 } |
1191 | 1174 |
1192 #define FWL_KEYFLAG_Ctrl» » » » » (1 << 0) | 1175 #define FWL_KEYFLAG_Ctrl (1 << 0) |
1193 #define FWL_KEYFLAG_Alt»» » » » » (1 << 1) | 1176 #define FWL_KEYFLAG_Alt (1 << 1) |
1194 #define FWL_KEYFLAG_Shift» » » » » (1 << 2) | 1177 #define FWL_KEYFLAG_Shift (1 << 2) |
1195 #define FWL_KEYFLAG_LButton» » » » » (1 << 3) | 1178 #define FWL_KEYFLAG_LButton (1 << 3) |
1196 #define FWL_KEYFLAG_RButton» » » » » (1 << 4) | 1179 #define FWL_KEYFLAG_RButton (1 << 4) |
1197 #define FWL_KEYFLAG_MButton» » » » » (1 << 5) | 1180 #define FWL_KEYFLAG_MButton (1 << 5) |
1198 | 1181 |
1199 FX_DWORD CPDFSDK_XFAAnnotHandler::GetFWLFlags(FX_DWORD dwFlag) | 1182 FX_DWORD CPDFSDK_XFAAnnotHandler::GetFWLFlags(FX_DWORD dwFlag) |
1200 { | 1183 { |
1201 » FX_DWORD dwFWLFlag = 0; | 1184 FX_DWORD dwFWLFlag = 0; |
1202 | 1185 |
1203 » if (dwFlag & FWL_EVENTFLAG_ControlKey) | 1186 if (dwFlag & FWL_EVENTFLAG_ControlKey) |
1204 » » dwFWLFlag |= FWL_KEYFLAG_Ctrl; | 1187 dwFWLFlag |= FWL_KEYFLAG_Ctrl; |
1205 » if (dwFlag & FWL_EVENTFLAG_LeftButtonDown) | 1188 if (dwFlag & FWL_EVENTFLAG_LeftButtonDown) |
1206 » » dwFWLFlag |= FWL_KEYFLAG_LButton; | 1189 dwFWLFlag |= FWL_KEYFLAG_LButton; |
1207 » if (dwFlag & FWL_EVENTFLAG_MiddleButtonDown) | 1190 if (dwFlag & FWL_EVENTFLAG_MiddleButtonDown) |
1208 » » dwFWLFlag |= FWL_KEYFLAG_MButton; | 1191 dwFWLFlag |= FWL_KEYFLAG_MButton; |
1209 » if (dwFlag & FWL_EVENTFLAG_RightButtonDown) | 1192 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) |
1210 » » dwFWLFlag |= FWL_KEYFLAG_RButton; | 1193 dwFWLFlag |= FWL_KEYFLAG_RButton; |
1211 » if (dwFlag & FWL_EVENTFLAG_ShiftKey) | 1194 if (dwFlag & FWL_EVENTFLAG_ShiftKey) |
1212 » » dwFWLFlag |= FWL_KEYFLAG_Shift; | 1195 dwFWLFlag |= FWL_KEYFLAG_Shift; |
1213 » if (dwFlag & FWL_EVENTFLAG_AltKey) | 1196 if (dwFlag & FWL_EVENTFLAG_AltKey) |
1214 » » dwFWLFlag |= FWL_KEYFLAG_Alt; | 1197 dwFWLFlag |= FWL_KEYFLAG_Alt; |
1215 | 1198 |
1216 » return dwFWLFlag; | 1199 return dwFWLFlag; |
1217 } | 1200 } |
1218 | 1201 |
1219 //CReader_AnnotIteratorEx | 1202 //CReader_AnnotIteratorEx |
1220 | 1203 |
1221 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO
L bReverse, | 1204 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO
L bReverse, |
1222 » » » » » » » » » »
» » FX_BOOL bIgnoreTopmost/*=FALSE*/, | 1205 FX_BOOL bIgnoreTopmost/*=FALSE*
/, |
1223 » » » » » » » » » »
» » FX_BOOL bCircle/*=FALSE*/, | 1206 FX_BOOL bCircle/*=FALSE*/, |
1224 » » » » » » » » » »
» » CFX_PtrArray *pList/*=NULL*/) | 1207 CFX_PtrArray *pList/*=NULL*/) |
1225 { | 1208 { |
1226 » ASSERT(pPageView); | 1209 ASSERT(pPageView); |
1227 » m_bReverse=bReverse; | 1210 m_bReverse=bReverse; |
1228 » m_bIgnoreTopmost= bIgnoreTopmost; | 1211 m_bIgnoreTopmost= bIgnoreTopmost; |
1229 » m_bCircle=bCircle; | 1212 m_bCircle=bCircle; |
1230 » m_pIteratorAnnotList.RemoveAll(); | 1213 m_pIteratorAnnotList.RemoveAll(); |
1231 » InitIteratorAnnotList(pPageView,pList); | 1214 InitIteratorAnnotList(pPageView,pList); |
1232 } | 1215 } |
1233 | 1216 |
1234 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::NextAnnot (const CPDFSDK_Annot* pCurrent) | 1217 CPDFSDK_Annot* CPDFSDK_AnnotIterator::NextAnnot (const CPDFSDK_Annot* pCurrent) |
1235 { | 1218 { |
1236 | 1219 |
1237 » int index = -1; | 1220 int index = -1; |
1238 » int nCount = m_pIteratorAnnotList.GetSize(); | 1221 int nCount = m_pIteratorAnnotList.GetSize(); |
1239 » if (pCurrent) { | 1222 if (pCurrent) { |
1240 » » for(int i=0;i<nCount;i++){ | 1223 for(int i=0;i<nCount;i++){ |
1241 » » » CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot *)m_pIterat
orAnnotList.GetAt(i); | 1224 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot *)m_pIteratorAnnotList.
GetAt(i); |
1242 » » » if(pReaderAnnot ==pCurrent){ | 1225 if(pReaderAnnot ==pCurrent){ |
1243 » » » » index=i; | 1226 index=i; |
1244 » » » » break; | 1227 break; |
1245 » » » } | 1228 } |
1246 » » } | 1229 } |
1247 » } | 1230 } |
1248 » return NextAnnot(index); | 1231 return NextAnnot(index); |
1249 } | 1232 } |
1250 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::PrevAnnot (const CPDFSDK_Annot*pCurrent) | 1233 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot (const CPDFSDK_Annot*pCurrent) |
1251 { | 1234 { |
1252 » int index = -1; | 1235 int index = -1; |
1253 » int nCount = m_pIteratorAnnotList.GetSize(); | 1236 int nCount = m_pIteratorAnnotList.GetSize(); |
1254 » if(pCurrent){ | 1237 if(pCurrent){ |
1255 » » for(int i=0;i<nCount;i++){ | 1238 for(int i=0;i<nCount;i++){ |
1256 » » » CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)m_pIterato
rAnnotList.GetAt(i); | 1239 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)m_pIteratorAnnotList.G
etAt(i); |
1257 » » » if(pReaderAnnot ==pCurrent){ | 1240 if(pReaderAnnot ==pCurrent){ |
1258 » » » » index=i; | 1241 index=i; |
1259 » » » » break; | 1242 break; |
1260 » » » } | 1243 } |
1261 » » } | 1244 } |
1262 » } | 1245 } |
1263 » return PrevAnnot(index); | 1246 return PrevAnnot(index); |
1264 } | 1247 } |
1265 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::NextAnnot (int& index) | 1248 CPDFSDK_Annot* CPDFSDK_AnnotIterator::NextAnnot (int& index) |
1266 { | 1249 { |
1267 | 1250 |
1268 » int nCount=m_pIteratorAnnotList.GetSize(); | 1251 int nCount=m_pIteratorAnnotList.GetSize(); |
1269 if(nCount<=0) index=-1; | 1252 if(nCount<=0) index=-1; |
1270 else{ | 1253 else{ |
1271 » » if(index<0){ | 1254 if(index<0){ |
1272 » » » index=0; | 1255 index=0; |
1273 » » } | 1256 } |
1274 » » else{ | 1257 else{ |
1275 » » » if(m_bCircle){ | 1258 if(m_bCircle){ |
1276 » » » » index=( index <nCount-1) ? (index+1) :0; | 1259 index=( index <nCount-1) ? (index+1) :0; |
1277 » » » } | 1260 } |
1278 » » » else{ | 1261 else{ |
1279 » » » » index=( index <nCount-1) ? (index+1) :-1; | 1262 index=( index <nCount-1) ? (index+1) :-1; |
1280 » » » } | 1263 } |
1281 | 1264 |
1282 » » } | 1265 } |
1283 » } | 1266 } |
1284 » return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(in
dex); | 1267 return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(index)
; |
1285 } | 1268 } |
1286 | 1269 |
1287 | 1270 |
1288 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::PrevAnnot (int& index) | 1271 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot (int& index) |
1289 { | 1272 { |
1290 | 1273 |
1291 » int nCount=m_pIteratorAnnotList.GetSize(); | 1274 int nCount=m_pIteratorAnnotList.GetSize(); |
1292 if(nCount<=0) index=-1; | 1275 if(nCount<=0) index=-1; |
1293 » else{ | 1276 else{ |
1294 » » if(index<0){ | 1277 if(index<0){ |
1295 » » » index=nCount-1; | 1278 index=nCount-1; |
1296 » » } | 1279 } |
1297 » » else{ | 1280 else{ |
1298 » » » if(m_bCircle){ | 1281 if(m_bCircle){ |
1299 » » » » index = ( index >0) ? (index-1) :nCount-1; | 1282 index = ( index >0) ? (index-1) :nCount-1; |
1300 » » » } | 1283 } |
1301 » » » else{ | 1284 else{ |
1302 » » » » index = ( index >0) ? (index-1) :-1; | 1285 index = ( index >0) ? (index-1) :-1; |
1303 » » » } | 1286 } |
1304 » » } | 1287 } |
1305 » } | 1288 } |
1306 » return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(in
dex); | 1289 return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(index)
; |
1307 } | 1290 } |
1308 | 1291 |
1309 | 1292 |
1310 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(const CPDFSDK_Annot* pCurrent) | 1293 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(const CPDFSDK_Annot* pCurrent) |
1311 { | 1294 { |
1312 | 1295 |
1313 » return (m_bReverse) ? PrevAnnot(pCurrent):NextAnnot(pCurrent); | 1296 return (m_bReverse) ? PrevAnnot(pCurrent):NextAnnot(pCurrent); |
1314 | 1297 |
1315 } | 1298 } |
1316 | 1299 |
1317 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::Prev(const CPDFSDK_Annot* pCurrent) | 1300 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(const CPDFSDK_Annot* pCurrent) |
1318 { | 1301 { |
1319 | 1302 |
1320 » return (m_bReverse) ? NextAnnot(pCurrent):PrevAnnot(pCurrent); | 1303 return (m_bReverse) ? NextAnnot(pCurrent):PrevAnnot(pCurrent); |
1321 } | 1304 } |
1322 | 1305 |
1323 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(int& index ) | 1306 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(int& index ) |
1324 { | 1307 { |
1325 | 1308 |
1326 » return (m_bReverse) ? PrevAnnot(index):NextAnnot(index); | 1309 return (m_bReverse) ? PrevAnnot(index):NextAnnot(index); |
1327 | 1310 |
1328 } | 1311 } |
1329 | 1312 |
1330 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::Prev(int& index ) | 1313 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(int& index ) |
1331 { | 1314 { |
1332 | 1315 |
1333 » return (m_bReverse) ? NextAnnot(index):PrevAnnot(index); | 1316 return (m_bReverse) ? NextAnnot(index):PrevAnnot(index); |
1334 } | 1317 } |
1335 | 1318 |
1336 | 1319 |
1337 void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp
are) | 1320 void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp
are) |
1338 { | 1321 { |
1339 » for (int i = 1; i < arrayList.GetSize(); i++) | 1322 for (int i = 1; i < arrayList.GetSize(); i++) |
1340 » { | 1323 { |
1341 » » if (pCompare((CPDFSDK_Annot*)(arrayList[i]) , (CPDFSDK_Annot*)(a
rrayList[i-1])) < 0) | 1324 if (pCompare((CPDFSDK_Annot*)(arrayList[i]) , (CPDFSDK_Annot*)(arrayList
[i-1])) < 0) |
1342 » » { | 1325 { |
1343 » » » int j = i-1; | 1326 int j = i-1; |
1344 » » » CPDFSDK_Annot* pTemp = (CPDFSDK_Annot*)arrayList[i]; | 1327 CPDFSDK_Annot* pTemp = (CPDFSDK_Annot*)arrayList[i]; |
1345 | 1328 |
1346 » » » do | 1329 do |
1347 » » » { | 1330 { |
1348 » » » » arrayList[j + 1] = arrayList[j]; | 1331 arrayList[j + 1] = arrayList[j]; |
1349 » » » } while (--j >= 0 && pCompare(pTemp, (CPDFSDK_Annot*)arr
ayList[j]) < 0); | 1332 } while (--j >= 0 && pCompare(pTemp, (CPDFSDK_Annot*)arrayList[j]) <
0); |
1350 | 1333 |
1351 » » » arrayList[j+1] = pTemp; | 1334 arrayList[j+1] = pTemp; |
1352 » » } | 1335 } |
1353 » } | 1336 } |
1354 } | 1337 } |
1355 | 1338 |
1356 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) | 1339 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) |
1357 { | 1340 { |
1358 » if(p1->GetLayoutOrder() < p2->GetLayoutOrder()) | 1341 if(p1->GetLayoutOrder() < p2->GetLayoutOrder()) |
1359 » » return -1; | 1342 return -1; |
1360 » else if (p1->GetLayoutOrder() == p2->GetLayoutOrder()) | 1343 else if (p1->GetLayoutOrder() == p2->GetLayoutOrder()) |
1361 » » return 0; | 1344 return 0; |
1362 » else | 1345 else |
1363 » » return 1; | 1346 return 1; |
1364 } | 1347 } |
1365 | 1348 |
1366 FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView
,CFX_PtrArray * pAnnotList) | 1349 FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView
,CFX_PtrArray * pAnnotList) |
1367 { | 1350 { |
1368 » ASSERT(pPageView); | 1351 ASSERT(pPageView); |
1369 | 1352 |
1370 » if(pAnnotList==NULL){ | 1353 if(pAnnotList==NULL){ |
1371 » » pAnnotList=pPageView->GetAnnotList(); | 1354 pAnnotList=pPageView->GetAnnotList(); |
1372 » } | 1355 } |
1373 | 1356 |
1374 » m_pIteratorAnnotList.RemoveAll(); | 1357 m_pIteratorAnnotList.RemoveAll(); |
1375 » if(!pAnnotList) return FALSE; | 1358 if(!pAnnotList) return FALSE; |
1376 | 1359 |
1377 » CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->Ge
tFocusAnnot(); | 1360 CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFoc
usAnnot(); |
1378 | 1361 |
1379 | 1362 |
1380 » int nCount =pAnnotList->GetSize(); | 1363 int nCount =pAnnotList->GetSize(); |
1381 | 1364 |
1382 » for(int i = nCount- 1 ;i >= 0;i--) | 1365 for(int i = nCount- 1 ;i >= 0;i--) |
1383 » { | 1366 { |
1384 » » CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(
i); | 1367 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); |
1385 » » m_pIteratorAnnotList.Add(pReaderAnnot); | 1368 m_pIteratorAnnotList.Add(pReaderAnnot); |
1386 » } | 1369 } |
1387 | 1370 |
1388 » InsertSort(m_pIteratorAnnotList,&LyOrderCompare); | 1371 InsertSort(m_pIteratorAnnotList,&LyOrderCompare); |
1389 | 1372 |
1390 » if(pTopMostAnnot) | 1373 if(pTopMostAnnot) |
1391 » { | 1374 { |
1392 » » for(int i=0 ;i<nCount;i++) | 1375 for(int i=0 ;i<nCount;i++) |
1393 » » { | 1376 { |
1394 » » » CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIterat
orAnnotList.GetAt(i); | 1377 CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIteratorAnnotList.
GetAt(i); |
1395 » » » if(pReaderAnnot == pTopMostAnnot) | 1378 if(pReaderAnnot == pTopMostAnnot) |
1396 » » » { | 1379 { |
1397 » » » » m_pIteratorAnnotList.RemoveAt(i); | 1380 m_pIteratorAnnotList.RemoveAt(i); |
1398 » » » » m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); | 1381 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); |
1399 » » » » break; | 1382 break; |
1400 » » » } | 1383 } |
1401 » » } | 1384 } |
1402 » } | 1385 } |
1403 | 1386 |
1404 » return TRUE; | 1387 return TRUE; |
1405 } | 1388 } |
1406 | |
OLD | NEW |