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/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
9 #include "../include/formfiller/FFL_FormFiller.h" | 9 #include "../include/formfiller/FFL_FormFiller.h" |
10 #include "../include/fsdk_annothandler.h" | 10 #include "../include/fsdk_annothandler.h" |
11 | 11 |
12 | 12 |
13 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) | 13 CPDFSDK_AnnotHandlerMgr::CPDFSDK_AnnotHandlerMgr(CPDFDoc_Environment* pApp) |
14 { | 14 { |
15 » m_pApp = pApp; | 15 m_pApp = pApp; |
16 | 16 |
17 » CPDFSDK_BFAnnotHandler* pHandler = new CPDFSDK_BFAnnotHandler(m_pApp); | 17 CPDFSDK_BFAnnotHandler* pHandler = new CPDFSDK_BFAnnotHandler(m_pApp); |
18 » pHandler->SetFormFiller(m_pApp->GetIFormFiller()); | 18 pHandler->SetFormFiller(m_pApp->GetIFormFiller()); |
19 » RegisterAnnotHandler(pHandler); | 19 RegisterAnnotHandler(pHandler); |
20 } | 20 } |
21 | 21 |
22 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() | 22 CPDFSDK_AnnotHandlerMgr::~CPDFSDK_AnnotHandlerMgr() |
23 { | 23 { |
24 » for(int i=0; i<m_Handlers.GetSize(); i++) | 24 for(int i=0; i<m_Handlers.GetSize(); i++) |
25 » { | 25 { |
26 » » IPDFSDK_AnnotHandler* pHandler = m_Handlers.GetAt(i); | 26 IPDFSDK_AnnotHandler* pHandler = m_Handlers.GetAt(i); |
27 » » delete pHandler; | 27 delete pHandler; |
28 » } | 28 } |
29 » m_Handlers.RemoveAll(); | 29 m_Handlers.RemoveAll(); |
30 » m_mapType2Handler.RemoveAll(); | 30 m_mapType2Handler.RemoveAll(); |
31 } | 31 } |
32 | 32 |
33 void» CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnn
otHandler) | 33 void CPDFSDK_AnnotHandlerMgr::RegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnn
otHandler) |
34 { | 34 { |
35 » ASSERT(pAnnotHandler != NULL); | 35 ASSERT(pAnnotHandler != NULL); |
36 | 36 |
37 » ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL); | 37 ASSERT(GetAnnotHandler(pAnnotHandler->GetType()) == NULL); |
38 | 38 |
39 » m_Handlers.Add(pAnnotHandler); | 39 m_Handlers.Add(pAnnotHandler); |
40 » m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler); | 40 m_mapType2Handler.SetAt(pAnnotHandler->GetType(), (void*)pAnnotHandler); |
41 } | 41 } |
42 | 42 |
43 void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnno
tHandler) | 43 void CPDFSDK_AnnotHandlerMgr::UnRegisterAnnotHandler(IPDFSDK_AnnotHandler* pAnno
tHandler) |
44 { | 44 { |
45 » ASSERT(pAnnotHandler != NULL); | 45 ASSERT(pAnnotHandler != NULL); |
46 | 46 |
47 » m_mapType2Handler.RemoveKey(pAnnotHandler->GetType()); | 47 m_mapType2Handler.RemoveKey(pAnnotHandler->GetType()); |
48 | 48 |
49 » for (int i=0, sz=m_Handlers.GetSize(); i<sz; i++) | 49 for (int i=0, sz=m_Handlers.GetSize(); i<sz; i++) |
50 » { | 50 { |
51 » » if (m_Handlers.GetAt(i) == pAnnotHandler) | 51 if (m_Handlers.GetAt(i) == pAnnotHandler) |
52 » » { | 52 { |
53 » » » m_Handlers.RemoveAt(i); | 53 m_Handlers.RemoveAt(i); |
54 » » » break; | 54 break; |
55 » » } | 55 } |
56 » } | 56 } |
57 } | 57 } |
58 | 58 |
59 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_Pa
geView *pPageView) | 59 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot * pAnnot, CPDFSDK_Pa
geView *pPageView) |
60 { | 60 { |
61 » ASSERT(pAnnot != NULL); | 61 ASSERT(pAnnot != NULL); |
62 » ASSERT(pPageView != NULL); | 62 ASSERT(pPageView != NULL); |
63 | 63 |
64 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSub
Type())) | 64 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot->GetSubType
())) |
65 » { | 65 { |
66 » » return pAnnotHandler->NewAnnot(pAnnot, pPageView); | 66 return pAnnotHandler->NewAnnot(pAnnot, pPageView); |
67 » } | 67 } |
68 | 68 |
69 » return new CPDFSDK_Annot(pAnnot, pPageView); | 69 return new CPDFSDK_Annot(pAnnot, pPageView); |
70 } | 70 } |
71 | 71 |
72 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 72 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
73 { | 73 { |
74 » ASSERT(pAnnot != NULL); | 74 ASSERT(pAnnot != NULL); |
75 | 75 |
76 » pAnnot->GetPDFPage(); | 76 pAnnot->GetPDFPage(); |
77 | 77 |
78 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 78 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
79 » { | 79 { |
80 » » pAnnotHandler->OnRelease(pAnnot); | 80 pAnnotHandler->OnRelease(pAnnot); |
81 » » pAnnotHandler->ReleaseAnnot(pAnnot); | 81 pAnnotHandler->ReleaseAnnot(pAnnot); |
82 » } | 82 } |
83 » else | 83 else |
84 » { | 84 { |
85 » » delete (CPDFSDK_Annot*)pAnnot; | 85 delete (CPDFSDK_Annot*)pAnnot; |
86 » } | 86 } |
87 } | 87 } |
88 | 88 |
89 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) | 89 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) |
90 { | 90 { |
91 » ASSERT(pAnnot != NULL); | 91 ASSERT(pAnnot != NULL); |
92 | 92 |
93 » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 93 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
94 | 94 |
95 » CPDFSDK_DateTime curTime; | 95 CPDFSDK_DateTime curTime; |
96 » pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString(
)); | 96 pPDFAnnot->GetAnnotDict()->SetAtString("M", curTime.ToPDFDateTimeString()); |
97 » pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); | 97 pPDFAnnot->GetAnnotDict()->SetAtNumber("F", 0); |
98 | 98 |
99 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 99 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
100 » { | 100 { |
101 » » pAnnotHandler->OnCreate(pAnnot); | 101 pAnnotHandler->OnCreate(pAnnot); |
102 » } | 102 } |
103 } | 103 } |
104 | 104 |
105 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) | 105 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) |
106 { | 106 { |
107 » ASSERT(pAnnot != NULL); | 107 ASSERT(pAnnot != NULL); |
108 | 108 |
109 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 109 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
110 » { | 110 { |
111 » » pAnnotHandler->OnLoad(pAnnot); | 111 pAnnotHandler->OnLoad(pAnnot); |
112 » } | 112 } |
113 } | 113 } |
114 | 114 |
115 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(CPDFSDK_Annot* pA
nnot) const | 115 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(CPDFSDK_Annot* pA
nnot) const |
116 { | 116 { |
117 » ASSERT(pAnnot != NULL); | 117 ASSERT(pAnnot != NULL); |
118 | 118 |
119 » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 119 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
120 » ASSERT(pPDFAnnot != NULL); | 120 ASSERT(pPDFAnnot != NULL); |
121 | 121 |
122 » return GetAnnotHandler(pPDFAnnot->GetSubType()); | 122 return GetAnnotHandler(pPDFAnnot->GetSubType()); |
123 } | 123 } |
124 | 124 |
125 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(const CFX_ByteStr
ing& sType) const | 125 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(const CFX_ByteStr
ing& sType) const |
126 { | 126 { |
127 » void* pRet = NULL; | 127 void* pRet = NULL; |
128 » m_mapType2Handler.Lookup(sType, pRet); | 128 m_mapType2Handler.Lookup(sType, pRet); |
129 » return (IPDFSDK_AnnotHandler*)pRet; | 129 return (IPDFSDK_AnnotHandler*)pRet; |
130 } | 130 } |
131 | 131 |
132 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_
Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwF
lags) | 132 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, CPDFSDK_
Annot* pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device,FX_DWORD dwF
lags) |
133 { | 133 { |
134 » ASSERT(pAnnot != NULL); | 134 ASSERT(pAnnot != NULL); |
135 | 135 |
136 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 136 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
137 » { | 137 { |
138 » » pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device,
dwFlags); | 138 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags)
; |
139 » } | 139 } |
140 » else | 140 else |
141 » { | 141 { |
142 » » pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal
, NULL); | 142 pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
143 » } | 143 } |
144 } | 144 } |
145 | 145 |
146 | 146 |
147 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 147 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
148 { | 148 { |
149 » ASSERT(pAnnot != NULL); | 149 ASSERT(pAnnot != NULL); |
150 | 150 |
151 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 151 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
152 » { | 152 { |
153 » » return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, p
oint); | 153 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
154 » } | 154 } |
155 » return FALSE; | 155 return FALSE; |
156 } | 156 } |
157 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 157 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
158 { | 158 { |
159 » ASSERT(pAnnot != NULL); | 159 ASSERT(pAnnot != NULL); |
160 | 160 |
161 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 161 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
162 » { | 162 { |
163 » » return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, poi
nt); | 163 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
164 » } | 164 } |
165 » return FALSE; | 165 return FALSE; |
166 } | 166 } |
167 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageV
iew, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 167 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageV
iew, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
168 { | 168 { |
169 » ASSERT(pAnnot != NULL); | 169 ASSERT(pAnnot != NULL); |
170 | 170 |
171 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 171 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
172 » { | 172 { |
173 » » return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags,
point); | 173 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
174 » } | 174 } |
175 » return FALSE; | 175 return FALSE; |
176 } | 176 } |
177 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 177 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
178 { | 178 { |
179 » ASSERT(pAnnot != NULL); | 179 ASSERT(pAnnot != NULL); |
180 | 180 |
181 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 181 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
182 » { | 182 { |
183 » » return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, poi
nt); | 183 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); |
184 » } | 184 } |
185 » return FALSE; | 185 return FALSE; |
186 } | 186 } |
187 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView
, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 187 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView
, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
188 { | 188 { |
189 » ASSERT(pAnnot != NULL); | 189 ASSERT(pAnnot != NULL); |
190 | 190 |
191 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 191 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
192 » { | 192 { |
193 » » return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDel
ta, point); | 193 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot,nFlags,zDelta, poin
t); |
194 » } | 194 } |
195 » return FALSE; | 195 return FALSE; |
196 } | 196 } |
197 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 197 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageVie
w, CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
198 { | 198 { |
199 » ASSERT(pAnnot != NULL); | 199 ASSERT(pAnnot != NULL); |
200 | 200 |
201 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 201 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
202 » { | 202 { |
203 » » return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, p
oint); | 203 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
204 » } | 204 } |
205 » return FALSE; | 205 return FALSE; |
206 } | 206 } |
207 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 207 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView,
CPDFSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
208 { | 208 { |
209 » ASSERT(pAnnot != NULL); | 209 ASSERT(pAnnot != NULL); |
210 | 210 |
211 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 211 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
212 » { | 212 { |
213 » » return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, poi
nt); | 213 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
214 » } | 214 } |
215 » return FALSE; | 215 return FALSE; |
216 } | 216 } |
217 | 217 |
218 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlag) | 218 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView * pPageView, C
PDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
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 » » pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); | 224 pAnnotHandler->OnMouseEnter(pPageView, pAnnot, nFlag); |
225 » } | 225 } |
226 » return ; | 226 return ; |
227 } | 227 } |
228 | 228 |
229 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlag) | 229 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseExit(CPDFSDK_PageView * pPageView, CP
DFSDK_Annot* pAnnot, FX_DWORD nFlag) |
230 { | 230 { |
231 » ASSERT(pAnnot != NULL); | 231 ASSERT(pAnnot != NULL); |
232 | 232 |
233 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 233 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
234 » { | 234 { |
235 » » pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); | 235 pAnnotHandler->OnMouseExit(pPageView, pAnnot, nFlag); |
236 » } | 236 } |
237 » return; | 237 return; |
238 } | 238 } |
239 | 239 |
240 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nC
har, FX_DWORD nFlags) | 240 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nC
har, FX_DWORD nFlags) |
241 { | 241 { |
242 | 242 |
243 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 243 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
244 » { | 244 { |
245 » » return pAnnotHandler->OnChar(pAnnot,nChar, nFlags); | 245 return pAnnotHandler->OnChar(pAnnot,nChar, nFlags); |
246 » } | 246 } |
247 » return FALSE; | 247 return FALSE; |
248 | 248 |
249 } | 249 } |
250 | 250 |
251 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot*
pAnnot, int nKeyCode, int nFlag) | 251 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyDown(CPDFSDK_Annot* pAnnot,
int nKeyCode, int nFlag) |
252 { | 252 { |
253 | 253 |
254 » if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag
)) | 254 if (!m_pApp->FFI_IsCTRLKeyDown(nFlag) && !m_pApp->FFI_IsALTKeyDown(nFlag)) |
255 » { | 255 { |
256 » » CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 256 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
257 » » CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); | 257 CPDFSDK_Annot* pFocusAnnot = pPage->GetFocusAnnot(); |
258 » » if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) | 258 if (pFocusAnnot && (nKeyCode == FWL_VKEY_Tab)) |
259 » » { | 259 { |
260 » » » CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp
->FFI_IsSHIFTKeyDown(nFlag)); | 260 CPDFSDK_Annot* pNext = GetNextAnnot(pFocusAnnot, !m_pApp->FFI_IsSHIF
TKeyDown(nFlag)); |
261 | 261 |
262 » » » if(pNext && pNext != pFocusAnnot) | 262 if(pNext && pNext != pFocusAnnot) |
263 » » » { | 263 { |
264 » » » » CPDFSDK_Document* pDocument = pPage->GetSDKDocum
ent(); | 264 CPDFSDK_Document* pDocument = pPage->GetSDKDocument(); |
265 » » » » pDocument->SetFocusAnnot(pNext); | 265 pDocument->SetFocusAnnot(pNext); |
266 » » » » return TRUE; | 266 return TRUE; |
267 » » » } | 267 } |
268 » » } | 268 } |
269 » } | 269 } |
270 | 270 |
271 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 271 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
272 » { | 272 { |
273 » » return pAnnotHandler->OnKeyDown(pAnnot,nKeyCode, nFlag); | 273 return pAnnotHandler->OnKeyDown(pAnnot,nKeyCode, nFlag); |
274 » } | 274 } |
275 » return FALSE; | 275 return FALSE; |
276 } | 276 } |
277 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pA
nnot, int nKeyCode, int nFlag) | 277 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, in
t nKeyCode, int nFlag) |
278 { | 278 { |
279 » return FALSE; | 279 return FALSE; |
280 } | 280 } |
281 | 281 |
282 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot*
pAnnot, FX_DWORD nFlag) | 282 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnSetFocus(CPDFSDK_Annot* pAnnot,
FX_DWORD nFlag) |
283 { | 283 { |
284 » ASSERT(pAnnot != NULL); | 284 ASSERT(pAnnot != NULL); |
285 | 285 |
286 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 286 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
287 » { | 287 { |
288 » » if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) | 288 if (pAnnotHandler->OnSetFocus(pAnnot, nFlag)) |
289 » » { | 289 { |
290 » » » CPDFSDK_PageView* pPage = pAnnot->GetPageView(); | 290 CPDFSDK_PageView* pPage = pAnnot->GetPageView(); |
291 » » » ASSERT(pPage != NULL); | 291 ASSERT(pPage != NULL); |
292 | 292 |
293 » » » pPage->GetSDKDocument(); | 293 pPage->GetSDKDocument(); |
294 » //» » pDocument->SetTopmostAnnot(pAnnot); | 294 // pDocument->SetTopmostAnnot(pAnnot); |
295 | 295 |
296 » » » return TRUE; | 296 return TRUE; |
297 » » } | 297 } |
298 » » else | 298 else |
299 » » { | 299 { |
300 » » » return FALSE; | 300 return FALSE; |
301 » » } | 301 } |
302 » } | 302 } |
303 | 303 |
304 » return FALSE; | 304 return FALSE; |
305 } | 305 } |
306 | 306 |
307 FX_BOOL»» » CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot
* pAnnot, FX_DWORD nFlag) | 307 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot
, FX_DWORD nFlag) |
308 { | 308 { |
309 » ASSERT(pAnnot != NULL); | 309 ASSERT(pAnnot != NULL); |
310 | 310 |
311 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 311 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
312 » { | 312 { |
313 » » if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) | 313 if (pAnnotHandler->OnKillFocus(pAnnot, nFlag)) |
314 » » { | 314 { |
315 » » » return TRUE; | 315 return TRUE; |
316 » » } | 316 } |
317 » » else | 317 else |
318 » » » return FALSE; | 318 return FALSE; |
319 » } | 319 } |
320 | 320 |
321 » return FALSE; | 321 return FALSE; |
322 } | 322 } |
323 | 323 |
324 CPDF_Rect» CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *p
PageView, CPDFSDK_Annot* pAnnot) | 324 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
View, CPDFSDK_Annot* pAnnot) |
325 { | 325 { |
326 » ASSERT(pAnnot); | 326 ASSERT(pAnnot); |
327 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 327 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
328 » { | 328 { |
329 » » return pAnnotHandler->GetViewBBox(pPageView, pAnnot); | 329 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); |
330 » } | 330 } |
331 » return pAnnot->GetRect(); | 331 return pAnnot->GetRect(); |
332 } | 332 } |
333 | 333 |
334 FX_BOOL»CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, const CPDF_Point& point) | 334 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, const CPDF_Point& point) |
335 { | 335 { |
336 » ASSERT(pAnnot); | 336 ASSERT(pAnnot); |
337 » if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 337 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
338 » { | 338 { |
339 » » if(pAnnotHandler->CanAnswer(pAnnot)) | 339 if(pAnnotHandler->CanAnswer(pAnnot)) |
340 » » » return pAnnotHandler->HitTest(pPageView, pAnnot, point); | 340 return pAnnotHandler->HitTest(pPageView, pAnnot, point); |
341 » } | 341 } |
342 » return FALSE; | 342 return FALSE; |
343 } | 343 } |
344 | 344 |
345 CPDFSDK_Annot*» CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
X_BOOL bNext) | 345 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
X_BOOL bNext) |
346 { | 346 { |
347 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); | 347 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); |
348 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 348 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
349 } | 349 } |
350 | 350 |
351 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) | 351 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) |
352 { | 352 { |
353 » ASSERT(pAnnot); | 353 ASSERT(pAnnot); |
354 » ASSERT(pAnnot->GetType() == "Widget"); | 354 ASSERT(pAnnot->GetType() == "Widget"); |
355 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 355 CFX_ByteString sSubType = pAnnot->GetSubType(); |
356 | 356 |
357 » if (sSubType == BFFT_SIGNATURE) | 357 if (sSubType == BFFT_SIGNATURE) |
358 » { | 358 { |
359 » } | 359 } |
360 » else | 360 else |
361 » { | 361 { |
362 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 362 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
363 » » if (!pWidget->IsVisible()) return FALSE; | 363 if (!pWidget->IsVisible()) return FALSE; |
364 | 364 |
365 » » int nFieldFlags = pWidget->GetFieldFlags(); | 365 int nFieldFlags = pWidget->GetFieldFlags(); |
366 » » if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) re
turn FALSE; | 366 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) return FAL
SE; |
367 » » if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 367 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
368 » » » return TRUE; | 368 return TRUE; |
369 » » else | 369 else |
370 » » { | 370 { |
371 » » » CPDF_Page* pPage = pWidget->GetPDFPage(); | 371 CPDF_Page* pPage = pWidget->GetPDFPage(); |
372 » » » ASSERT(pPage != NULL); | 372 ASSERT(pPage != NULL); |
373 | 373 |
374 » » » CPDF_Document* pDocument = pPage->m_pDocument; | 374 CPDF_Document* pDocument = pPage->m_pDocument; |
375 » » » ASSERT(pDocument != NULL); | 375 ASSERT(pDocument != NULL); |
376 | 376 |
377 » » » FX_DWORD dwPermissions = pDocument->GetUserPermissions()
; | 377 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
378 » » » return (dwPermissions&FPDFPERM_FILL_FORM) || | 378 return (dwPermissions&FPDFPERM_FILL_FORM) || |
379 » » » » (dwPermissions&FPDFPERM_ANNOT_FORM) || | 379 (dwPermissions&FPDFPERM_ANNOT_FORM) || |
380 » » » (dwPermissions&FPDFPERM_ANNOT_FORM); | 380 (dwPermissions&FPDFPERM_ANNOT_FORM); |
381 » » } | 381 } |
382 » } | 382 } |
383 | 383 |
384 » return FALSE; | 384 return FALSE; |
385 } | 385 } |
386 | 386 |
387 CPDFSDK_Annot*» » CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPD
FSDK_PageView* pPage) | 387 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Page
View* pPage) |
388 { | 388 { |
389 » ASSERT(pPage != NULL); | 389 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
390 » pPage->GetPDFDocument(); | 390 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); |
391 | 391 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInte
rForm(), pAnnot->GetAnnotDict()); |
392 » CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); | 392 if (!pCtrl) |
393 » ASSERT(pSDKDoc); | 393 return nullptr; |
394 » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterFor
m(); | 394 |
395 » ASSERT(pInterForm != NULL); | 395 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
396 | 396 pInterForm->AddMap(pCtrl, pWidget); |
397 » CPDFSDK_Widget* pWidget = NULL; | 397 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
398 » if (CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm-
>GetInterForm(), pAnnot->GetAnnotDict())) | 398 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
399 » { | 399 pWidget->ResetAppearance(nullptr, FALSE); |
400 » » pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 400 |
401 » » pInterForm->AddMap(pCtrl, pWidget); | 401 return pWidget; |
402 » » CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | |
403 » » if(pPDFInterForm && pPDFInterForm->NeedConstructAP()) | |
404 » » » pWidget->ResetAppearance(NULL,FALSE); | |
405 » } | |
406 | |
407 » return pWidget; | |
408 } | 402 } |
409 | 403 |
410 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 404 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
411 { | 405 { |
412 » ASSERT(pAnnot != NULL); | 406 ASSERT(pAnnot != NULL); |
413 | 407 |
414 » if (m_pFormFiller) | 408 if (m_pFormFiller) |
415 » » m_pFormFiller->OnDelete(pAnnot); | 409 m_pFormFiller->OnDelete(pAnnot); |
416 | 410 |
417 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 411 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
418 » CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 412 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
419 » ASSERT(pInterForm != NULL); | 413 ASSERT(pInterForm != NULL); |
420 | 414 |
421 » CPDF_FormControl* pCtrol = pWidget->GetFormControl(); | 415 CPDF_FormControl* pCtrol = pWidget->GetFormControl(); |
422 » pInterForm->RemoveMap(pCtrol); | 416 pInterForm->RemoveMap(pCtrol); |
423 | 417 |
424 | 418 |
425 » delete pWidget; | 419 delete pWidget; |
426 } | 420 } |
427 | 421 |
428 | 422 |
429 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) | 423 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, FX_DWORD dwFlags) |
430 { | 424 { |
431 » ASSERT(pAnnot != NULL); | 425 ASSERT(pAnnot != NULL); |
432 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 426 CFX_ByteString sSubType = pAnnot->GetSubType(); |
433 | 427 |
434 » if (sSubType == BFFT_SIGNATURE) | 428 if (sSubType == BFFT_SIGNATURE) |
435 » { | 429 { |
436 » » pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal
, NULL); | 430 pAnnot->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
437 » } | 431 } |
438 » else | 432 else |
439 » { | 433 { |
440 » » if (m_pFormFiller) | 434 if (m_pFormFiller) |
441 » » { | 435 { |
442 » » » m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2
Device, dwFlags); | 436 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFl
ags); |
443 » » } | 437 } |
444 » } | 438 } |
445 } | 439 } |
446 | 440 |
447 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlag) | 441 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlag) |
448 { | 442 { |
449 » ASSERT(pAnnot != NULL); | 443 ASSERT(pAnnot != NULL); |
450 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 444 CFX_ByteString sSubType = pAnnot->GetSubType(); |
451 | 445 |
452 » if (sSubType == BFFT_SIGNATURE) | 446 if (sSubType == BFFT_SIGNATURE) |
453 » { | 447 { |
454 » } | 448 } |
455 » else | 449 else |
456 » { | 450 { |
457 » » if (m_pFormFiller) | 451 if (m_pFormFiller) |
458 » » » m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); | 452 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); |
459 » } | 453 } |
460 | 454 |
461 | 455 |
462 } | 456 } |
463 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlag) | 457 void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlag) |
464 { | 458 { |
465 » ASSERT(pAnnot != NULL); | 459 ASSERT(pAnnot != NULL); |
466 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 460 CFX_ByteString sSubType = pAnnot->GetSubType(); |
467 | 461 |
468 » if (sSubType == BFFT_SIGNATURE) | 462 if (sSubType == BFFT_SIGNATURE) |
469 » { | 463 { |
470 » } | 464 } |
471 » else | 465 else |
472 » { | 466 { |
473 » » if (m_pFormFiller) | 467 if (m_pFormFiller) |
474 » » » m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); | 468 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); |
475 » } | 469 } |
476 | 470 |
477 } | 471 } |
478 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 472 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
479 { | 473 { |
480 » ASSERT(pAnnot != NULL); | 474 ASSERT(pAnnot != NULL); |
481 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 475 CFX_ByteString sSubType = pAnnot->GetSubType(); |
482 | 476 |
483 » if (sSubType == BFFT_SIGNATURE) | 477 if (sSubType == BFFT_SIGNATURE) |
484 » { | 478 { |
485 » } | 479 } |
486 » else | 480 else |
487 » { | 481 { |
488 » » if (m_pFormFiller) | 482 if (m_pFormFiller) |
489 » » » return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, n
Flags, point); | 483 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point
); |
490 » } | 484 } |
491 | 485 |
492 » return FALSE; | 486 return FALSE; |
493 } | 487 } |
494 | 488 |
495 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 489 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
496 { | 490 { |
497 » ASSERT(pAnnot != NULL); | 491 ASSERT(pAnnot != NULL); |
498 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 492 CFX_ByteString sSubType = pAnnot->GetSubType(); |
499 | 493 |
500 » if (sSubType == BFFT_SIGNATURE) | 494 if (sSubType == BFFT_SIGNATURE) |
501 » { | 495 { |
502 » } | 496 } |
503 » else | 497 else |
504 » { | 498 { |
505 » » if (m_pFormFiller) | 499 if (m_pFormFiller) |
506 » » » return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFl
ags, point); | 500 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
507 » } | 501 } |
508 | 502 |
509 » return FALSE; | 503 return FALSE; |
510 } | 504 } |
511 | 505 |
512 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD
FSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 506 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD
FSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
513 { | 507 { |
514 » ASSERT(pAnnot != NULL); | 508 ASSERT(pAnnot != NULL); |
515 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 509 CFX_ByteString sSubType = pAnnot->GetSubType(); |
516 | 510 |
517 » if (sSubType == BFFT_SIGNATURE) | 511 if (sSubType == BFFT_SIGNATURE) |
518 » { | 512 { |
519 » } | 513 } |
520 » else | 514 else |
521 » { | 515 { |
522 » » if (m_pFormFiller) | 516 if (m_pFormFiller) |
523 » » » return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot,
nFlags, point); | 517 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, poi
nt); |
524 » } | 518 } |
525 | 519 |
526 » return FALSE; | 520 return FALSE; |
527 } | 521 } |
528 | 522 |
529 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 523 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
530 { | 524 { |
531 » ASSERT(pAnnot != NULL); | 525 ASSERT(pAnnot != NULL); |
532 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 526 CFX_ByteString sSubType = pAnnot->GetSubType(); |
533 | 527 |
534 » if (sSubType == BFFT_SIGNATURE) | 528 if (sSubType == BFFT_SIGNATURE) |
535 » { | 529 { |
536 » } | 530 } |
537 » else | 531 else |
538 » { | 532 { |
539 » » if (m_pFormFiller) | 533 if (m_pFormFiller) |
540 » » » return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFl
ags, point); | 534 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
541 » } | 535 } |
542 | 536 |
543 » return FALSE; | 537 return FALSE; |
544 | 538 |
545 } | 539 } |
546 | 540 |
547 | 541 |
548 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 542 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
549 { | 543 { |
550 » ASSERT(pAnnot != NULL); | 544 ASSERT(pAnnot != NULL); |
551 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 545 CFX_ByteString sSubType = pAnnot->GetSubType(); |
552 | 546 |
553 » if (sSubType == BFFT_SIGNATURE) | 547 if (sSubType == BFFT_SIGNATURE) |
554 » { | 548 { |
555 » } | 549 } |
556 » else | 550 else |
557 » { | 551 { |
558 » » if (m_pFormFiller) | 552 if (m_pFormFiller) |
559 » » » return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nF
lags, zDelta,point); | 553 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta
,point); |
560 » } | 554 } |
561 | 555 |
562 » return FALSE; | 556 return FALSE; |
563 } | 557 } |
564 | 558 |
565 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 559 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
566 { | 560 { |
567 » ASSERT(pAnnot != NULL); | 561 ASSERT(pAnnot != NULL); |
568 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 562 CFX_ByteString sSubType = pAnnot->GetSubType(); |
569 | 563 |
570 » if (sSubType == BFFT_SIGNATURE) | 564 if (sSubType == BFFT_SIGNATURE) |
571 » { | 565 { |
572 » } | 566 } |
573 » else | 567 else |
574 » { | 568 { |
575 » » if (m_pFormFiller) | 569 if (m_pFormFiller) |
576 » » » return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, n
Flags, point); | 570 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point
); |
577 » } | 571 } |
578 | 572 |
579 » return FALSE; | 573 return FALSE; |
580 } | 574 } |
581 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 575 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
582 { | 576 { |
583 » ASSERT(pAnnot != NULL); | 577 ASSERT(pAnnot != NULL); |
584 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 578 CFX_ByteString sSubType = pAnnot->GetSubType(); |
585 | 579 |
586 » if (sSubType == BFFT_SIGNATURE) | 580 if (sSubType == BFFT_SIGNATURE) |
587 » { | 581 { |
588 » } | 582 } |
589 » else | 583 else |
590 » { | 584 { |
591 » » if (m_pFormFiller) | 585 if (m_pFormFiller) |
592 » » » return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFl
ags, point); | 586 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
593 » } | 587 } |
594 | 588 |
595 » return FALSE; | 589 return FALSE; |
596 } | 590 } |
597 | 591 |
598 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX
_DWORD nFlags) | 592 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX
_DWORD nFlags) |
599 { | 593 { |
600 » ASSERT(pAnnot != NULL); | 594 ASSERT(pAnnot != NULL); |
601 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 595 CFX_ByteString sSubType = pAnnot->GetSubType(); |
602 | 596 |
603 » if (sSubType == BFFT_SIGNATURE) | 597 if (sSubType == BFFT_SIGNATURE) |
604 » { | 598 { |
605 » } | 599 } |
606 » else | 600 else |
607 » { | 601 { |
608 » » if (m_pFormFiller) | 602 if (m_pFormFiller) |
609 » » » return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); | 603 return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); |
610 » } | 604 } |
611 | 605 |
612 » return FALSE; | 606 return FALSE; |
613 } | 607 } |
614 | 608 |
615 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i
nt nFlag) | 609 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i
nt nFlag) |
616 { | 610 { |
617 » ASSERT(pAnnot != NULL); | 611 ASSERT(pAnnot != NULL); |
618 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 612 CFX_ByteString sSubType = pAnnot->GetSubType(); |
619 | 613 |
620 » if (sSubType == BFFT_SIGNATURE) | 614 if (sSubType == BFFT_SIGNATURE) |
621 » { | 615 { |
622 » } | 616 } |
623 » else | 617 else |
624 » { | 618 { |
625 » » if (m_pFormFiller) | 619 if (m_pFormFiller) |
626 » » » return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); | 620 return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); |
627 » } | 621 } |
628 | 622 |
629 » return FALSE; | 623 return FALSE; |
630 } | 624 } |
631 | 625 |
632 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) | 626 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) |
633 { | 627 { |
634 | 628 |
635 » return FALSE; | 629 return FALSE; |
636 } | 630 } |
637 void» CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) | 631 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) |
638 { | 632 { |
639 » ASSERT(pAnnot != NULL); | 633 ASSERT(pAnnot != NULL); |
640 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 634 CFX_ByteString sSubType = pAnnot->GetSubType(); |
641 | 635 |
642 » if (sSubType == BFFT_SIGNATURE) | 636 if (sSubType == BFFT_SIGNATURE) |
643 » { | 637 { |
644 » } | 638 } |
645 » else | 639 else |
646 » { | 640 { |
647 » » if (m_pFormFiller) | 641 if (m_pFormFiller) |
648 » » » m_pFormFiller->OnCreate(pAnnot); | 642 m_pFormFiller->OnCreate(pAnnot); |
649 » } | 643 } |
650 } | 644 } |
651 | 645 |
652 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) | 646 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) |
653 { | 647 { |
654 » ASSERT(pAnnot != NULL); | 648 ASSERT(pAnnot != NULL); |
655 | 649 |
656 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 650 CFX_ByteString sSubType = pAnnot->GetSubType(); |
657 | 651 |
658 » if (sSubType == BFFT_SIGNATURE) | 652 if (sSubType == BFFT_SIGNATURE) |
659 » { | 653 { |
660 » } | 654 } |
661 » else | 655 else |
662 » { | 656 { |
663 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 657 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
664 » » if (!pWidget->IsAppearanceValid()) | 658 if (!pWidget->IsAppearanceValid()) |
665 » » » pWidget->ResetAppearance(NULL, FALSE); | 659 pWidget->ResetAppearance(NULL, FALSE); |
666 | 660 |
667 » » int nFieldType = pWidget->GetFieldType(); | 661 int nFieldType = pWidget->GetFieldType(); |
668 » » if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE
_COMBOBOX) | 662 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBO
X) |
669 » » { | 663 { |
670 » » » FX_BOOL bFormated = FALSE; | 664 FX_BOOL bFormated = FALSE; |
671 » » » CFX_WideString sValue = pWidget->OnFormat(bFormated); | 665 CFX_WideString sValue = pWidget->OnFormat(bFormated); |
672 » » » if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) | 666 if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) |
673 » » » { | 667 { |
674 » » » » pWidget->ResetAppearance(sValue.c_str(), FALSE); | 668 pWidget->ResetAppearance(sValue.c_str(), FALSE); |
675 » » » } | 669 } |
676 » » } | 670 } |
677 | 671 |
678 » » if (m_pFormFiller) | 672 if (m_pFormFiller) |
679 » » » m_pFormFiller->OnLoad(pAnnot); | 673 m_pFormFiller->OnLoad(pAnnot); |
680 » } | 674 } |
681 } | 675 } |
682 | 676 |
683 FX_BOOL»CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag
) | 677 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag
) |
684 { | 678 { |
685 » ASSERT(pAnnot != NULL); | 679 ASSERT(pAnnot != NULL); |
686 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 680 CFX_ByteString sSubType = pAnnot->GetSubType(); |
687 | 681 |
688 » if (sSubType == BFFT_SIGNATURE) | 682 if (sSubType == BFFT_SIGNATURE) |
689 » { | 683 { |
690 » } | 684 } |
691 » else | 685 else |
692 » { | 686 { |
693 » » if (m_pFormFiller) | 687 if (m_pFormFiller) |
694 » » » return m_pFormFiller->OnSetFocus(pAnnot,nFlag); | 688 return m_pFormFiller->OnSetFocus(pAnnot,nFlag); |
695 » } | 689 } |
696 | 690 |
697 » return TRUE; | 691 return TRUE; |
698 } | 692 } |
699 FX_BOOL»CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) | 693 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) |
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 » » » return m_pFormFiller->OnKillFocus(pAnnot,nFlag); | 704 return m_pFormFiller->OnKillFocus(pAnnot,nFlag); |
711 » } | 705 } |
712 | 706 |
713 » return TRUE; | 707 return TRUE; |
714 } | 708 } |
715 | 709 |
716 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) | 710 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) |
717 { | 711 { |
718 » ASSERT(pAnnot != NULL); | 712 ASSERT(pAnnot != NULL); |
719 » CFX_ByteString sSubType = pAnnot->GetSubType(); | 713 CFX_ByteString sSubType = pAnnot->GetSubType(); |
720 | 714 |
721 » if (sSubType == BFFT_SIGNATURE) | 715 if (sSubType == BFFT_SIGNATURE) |
722 » { | 716 { |
723 » } | 717 } |
724 » else | 718 else |
725 » { | 719 { |
726 » » if (m_pFormFiller) | 720 if (m_pFormFiller) |
727 » » » return m_pFormFiller->GetViewBBox(pPageView, pAnnot); | 721 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); |
728 | 722 |
729 » } | 723 } |
730 | 724 |
731 » return CPDF_Rect(0,0,0,0); | 725 return CPDF_Rect(0,0,0,0); |
732 } | 726 } |
733 | 727 |
734 FX_BOOL»CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Ann
ot* pAnnot, const CPDF_Point& point) | 728 FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Ann
ot* pAnnot, const CPDF_Point& point) |
735 { | 729 { |
736 » ASSERT(pPageView); | 730 ASSERT(pPageView); |
737 » ASSERT(pAnnot); | 731 ASSERT(pAnnot); |
738 | 732 |
739 » CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); | 733 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); |
740 » return rect.Contains(point.x, point.y); | 734 return rect.Contains(point.x, point.y); |
741 } | 735 } |
742 | 736 |
743 //CReader_AnnotIteratorEx | 737 //CReader_AnnotIteratorEx |
744 | 738 |
745 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO
L bReverse, | 739 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO
L bReverse, |
746 » » » » » » » » » »
» » FX_BOOL bIgnoreTopmost/*=FALSE*/, | 740 FX_BOOL bIgnoreTopmost/*=FALSE*
/, |
747 » » » » » » » » » »
» » FX_BOOL bCircle/*=FALSE*/, | 741 FX_BOOL bCircle/*=FALSE*/, |
748 » » » » » » » » » »
» » CFX_PtrArray *pList/*=NULL*/) | 742 CFX_PtrArray *pList/*=NULL*/) |
749 { | 743 { |
750 » ASSERT(pPageView); | 744 ASSERT(pPageView); |
751 » m_bReverse=bReverse; | 745 m_bReverse=bReverse; |
752 » m_bIgnoreTopmost= bIgnoreTopmost; | 746 m_bIgnoreTopmost= bIgnoreTopmost; |
753 » m_bCircle=bCircle; | 747 m_bCircle=bCircle; |
754 » m_pIteratorAnnotList.RemoveAll(); | 748 m_pIteratorAnnotList.RemoveAll(); |
755 » InitIteratorAnnotList(pPageView,pList); | 749 InitIteratorAnnotList(pPageView,pList); |
756 } | 750 } |
757 | 751 |
758 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::NextAnnot (const CPDFSDK_Annot* pCurrent) | 752 CPDFSDK_Annot* CPDFSDK_AnnotIterator::NextAnnot (const CPDFSDK_Annot* pCurrent) |
759 { | 753 { |
760 | 754 |
761 » int index = -1; | 755 int index = -1; |
762 » int nCount = m_pIteratorAnnotList.GetSize(); | 756 int nCount = m_pIteratorAnnotList.GetSize(); |
763 » if (pCurrent) { | 757 if (pCurrent) { |
764 » » for(int i=0;i<nCount;i++){ | 758 for(int i=0;i<nCount;i++){ |
765 » » » CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot *)m_pIterat
orAnnotList.GetAt(i); | 759 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot *)m_pIteratorAnnotList.
GetAt(i); |
766 » » » if(pReaderAnnot ==pCurrent){ | 760 if(pReaderAnnot ==pCurrent){ |
767 » » » » index=i; | 761 index=i; |
768 » » » » break; | 762 break; |
769 » » » } | 763 } |
770 » » } | 764 } |
771 » } | 765 } |
772 » return NextAnnot(index); | 766 return NextAnnot(index); |
773 } | 767 } |
774 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::PrevAnnot (const CPDFSDK_Annot*pCurrent) | 768 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot (const CPDFSDK_Annot*pCurrent) |
775 { | 769 { |
776 » int index = -1; | 770 int index = -1; |
777 » int nCount = m_pIteratorAnnotList.GetSize(); | 771 int nCount = m_pIteratorAnnotList.GetSize(); |
778 » if(pCurrent){ | 772 if(pCurrent){ |
779 » » for(int i=0;i<nCount;i++){ | 773 for(int i=0;i<nCount;i++){ |
780 » » » CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)m_pIterato
rAnnotList.GetAt(i); | 774 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)m_pIteratorAnnotList.G
etAt(i); |
781 » » » if(pReaderAnnot ==pCurrent){ | 775 if(pReaderAnnot ==pCurrent){ |
782 » » » » index=i; | 776 index=i; |
783 » » » » break; | 777 break; |
784 » » » } | 778 } |
785 » » } | 779 } |
786 » } | 780 } |
787 » return PrevAnnot(index); | 781 return PrevAnnot(index); |
788 } | 782 } |
789 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::NextAnnot (int& index) | 783 CPDFSDK_Annot* CPDFSDK_AnnotIterator::NextAnnot (int& index) |
790 { | 784 { |
791 | 785 |
792 » int nCount=m_pIteratorAnnotList.GetSize(); | 786 int nCount=m_pIteratorAnnotList.GetSize(); |
793 if(nCount<=0) index=-1; | 787 if(nCount<=0) index=-1; |
794 else{ | 788 else{ |
795 » » if(index<0){ | 789 if(index<0){ |
796 » » » index=0; | 790 index=0; |
797 » » } | 791 } |
798 » » else{ | 792 else{ |
799 » » » if(m_bCircle){ | 793 if(m_bCircle){ |
800 » » » » index=( index <nCount-1) ? (index+1) :0; | 794 index=( index <nCount-1) ? (index+1) :0; |
801 » » » } | 795 } |
802 » » » else{ | 796 else{ |
803 » » » » index=( index <nCount-1) ? (index+1) :-1; | 797 index=( index <nCount-1) ? (index+1) :-1; |
804 » » » } | 798 } |
805 | 799 |
806 » » } | 800 } |
807 » } | 801 } |
808 » return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(in
dex); | 802 return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(index)
; |
809 } | 803 } |
810 | 804 |
811 | 805 |
812 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::PrevAnnot (int& index) | 806 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot (int& index) |
813 { | 807 { |
814 | 808 |
815 » int nCount=m_pIteratorAnnotList.GetSize(); | 809 int nCount=m_pIteratorAnnotList.GetSize(); |
816 if(nCount<=0) index=-1; | 810 if(nCount<=0) index=-1; |
817 » else{ | 811 else{ |
818 » » if(index<0){ | 812 if(index<0){ |
819 » » » index=nCount-1; | 813 index=nCount-1; |
820 » » } | 814 } |
821 » » else{ | 815 else{ |
822 » » » if(m_bCircle){ | 816 if(m_bCircle){ |
823 » » » » index = ( index >0) ? (index-1) :nCount-1; | 817 index = ( index >0) ? (index-1) :nCount-1; |
824 » » » } | 818 } |
825 » » » else{ | 819 else{ |
826 » » » » index = ( index >0) ? (index-1) :-1; | 820 index = ( index >0) ? (index-1) :-1; |
827 » » » } | 821 } |
828 » » } | 822 } |
829 » } | 823 } |
830 » return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(in
dex); | 824 return (index <0) ? NULL : (CPDFSDK_Annot*)m_pIteratorAnnotList.GetAt(index)
; |
831 } | 825 } |
832 | 826 |
833 | 827 |
834 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(const CPDFSDK_Annot* pCurrent) | 828 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(const CPDFSDK_Annot* pCurrent) |
835 { | 829 { |
836 | 830 |
837 » return (m_bReverse) ? PrevAnnot(pCurrent):NextAnnot(pCurrent); | 831 return (m_bReverse) ? PrevAnnot(pCurrent):NextAnnot(pCurrent); |
838 | 832 |
839 } | 833 } |
840 | 834 |
841 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::Prev(const CPDFSDK_Annot* pCurrent) | 835 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(const CPDFSDK_Annot* pCurrent) |
842 { | 836 { |
843 | 837 |
844 » return (m_bReverse) ? NextAnnot(pCurrent):PrevAnnot(pCurrent); | 838 return (m_bReverse) ? NextAnnot(pCurrent):PrevAnnot(pCurrent); |
845 } | 839 } |
846 | 840 |
847 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(int& index ) | 841 CPDFSDK_Annot*CPDFSDK_AnnotIterator::Next(int& index ) |
848 { | 842 { |
849 | 843 |
850 » return (m_bReverse) ? PrevAnnot(index):NextAnnot(index); | 844 return (m_bReverse) ? PrevAnnot(index):NextAnnot(index); |
851 | 845 |
852 } | 846 } |
853 | 847 |
854 CPDFSDK_Annot*» CPDFSDK_AnnotIterator::Prev(int& index ) | 848 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Prev(int& index ) |
855 { | 849 { |
856 | 850 |
857 » return (m_bReverse) ? NextAnnot(index):PrevAnnot(index); | 851 return (m_bReverse) ? NextAnnot(index):PrevAnnot(index); |
858 } | 852 } |
859 | 853 |
860 | 854 |
861 void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp
are) | 855 void CPDFSDK_AnnotIterator::InsertSort(CFX_PtrArray &arrayList, AI_COMPARE pComp
are) |
862 { | 856 { |
863 » for (int i = 1; i < arrayList.GetSize(); i++) | 857 for (int i = 1; i < arrayList.GetSize(); i++) |
864 » { | 858 { |
865 » » if (pCompare((CPDFSDK_Annot*)(arrayList[i]) , (CPDFSDK_Annot*)(a
rrayList[i-1])) < 0) | 859 if (pCompare((CPDFSDK_Annot*)(arrayList[i]) , (CPDFSDK_Annot*)(arrayList
[i-1])) < 0) |
866 » » { | 860 { |
867 » » » int j = i-1; | 861 int j = i-1; |
868 » » » CPDFSDK_Annot* pTemp = (CPDFSDK_Annot*)arrayList[i]; | 862 CPDFSDK_Annot* pTemp = (CPDFSDK_Annot*)arrayList[i]; |
869 | 863 |
870 » » » do | 864 do |
871 » » » { | 865 { |
872 » » » » arrayList[j + 1] = arrayList[j]; | 866 arrayList[j + 1] = arrayList[j]; |
873 » » » } while (--j >= 0 && pCompare(pTemp, (CPDFSDK_Annot*)arr
ayList[j]) < 0); | 867 } while (--j >= 0 && pCompare(pTemp, (CPDFSDK_Annot*)arrayList[j]) <
0); |
874 | 868 |
875 » » » arrayList[j+1] = pTemp; | 869 arrayList[j+1] = pTemp; |
876 » » } | 870 } |
877 » } | 871 } |
878 } | 872 } |
879 | 873 |
880 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) | 874 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) |
881 { | 875 { |
882 » if(p1->GetLayoutOrder() < p2->GetLayoutOrder()) | 876 if(p1->GetLayoutOrder() < p2->GetLayoutOrder()) |
883 » » return -1; | 877 return -1; |
884 » else if (p1->GetLayoutOrder() == p2->GetLayoutOrder()) | 878 else if (p1->GetLayoutOrder() == p2->GetLayoutOrder()) |
885 » » return 0; | 879 return 0; |
886 » else | 880 else |
887 » » return 1; | 881 return 1; |
888 } | 882 } |
889 | 883 |
890 FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView
,CFX_PtrArray * pAnnotList) | 884 FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView
,CFX_PtrArray * pAnnotList) |
891 { | 885 { |
892 » ASSERT(pPageView); | 886 ASSERT(pPageView); |
893 | 887 |
894 » if(pAnnotList==NULL){ | 888 if(pAnnotList==NULL){ |
895 » » pAnnotList=pPageView->GetAnnotList(); | 889 pAnnotList=pPageView->GetAnnotList(); |
896 » } | 890 } |
897 | 891 |
898 » m_pIteratorAnnotList.RemoveAll(); | 892 m_pIteratorAnnotList.RemoveAll(); |
899 » if(!pAnnotList) return FALSE; | 893 if(!pAnnotList) return FALSE; |
900 | 894 |
901 » CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->Ge
tFocusAnnot(); | 895 CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFoc
usAnnot(); |
902 | 896 |
903 | 897 |
904 » int nCount =pAnnotList->GetSize(); | 898 int nCount =pAnnotList->GetSize(); |
905 | 899 |
906 » for(int i = nCount- 1 ;i >= 0;i--) | 900 for(int i = nCount- 1 ;i >= 0;i--) |
907 » { | 901 { |
908 » » CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(
i); | 902 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); |
909 » » m_pIteratorAnnotList.Add(pReaderAnnot); | 903 m_pIteratorAnnotList.Add(pReaderAnnot); |
910 » } | 904 } |
911 | 905 |
912 » InsertSort(m_pIteratorAnnotList,&LyOrderCompare); | 906 InsertSort(m_pIteratorAnnotList,&LyOrderCompare); |
913 | 907 |
914 » if(pTopMostAnnot) | 908 if(pTopMostAnnot) |
915 » { | 909 { |
916 » » for(int i=0 ;i<nCount;i++) | 910 for(int i=0 ;i<nCount;i++) |
917 » » { | 911 { |
918 » » » CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIterat
orAnnotList.GetAt(i); | 912 CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIteratorAnnotList.
GetAt(i); |
919 » » » if(pReaderAnnot == pTopMostAnnot) | 913 if(pReaderAnnot == pTopMostAnnot) |
920 » » » { | 914 { |
921 » » » » m_pIteratorAnnotList.RemoveAt(i); | 915 m_pIteratorAnnotList.RemoveAt(i); |
922 » » » » m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); | 916 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); |
923 » » » » break; | 917 break; |
924 » » » } | 918 } |
925 » » } | 919 } |
926 » } | 920 } |
927 | 921 |
928 » return TRUE; | 922 return TRUE; |
929 } | 923 } |
930 | |
OLD | NEW |