| 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" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown(CPDFSDK_PageView * pPageView,
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, point); | 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView * pPageView, CP
DFSDK_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, point); | 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk(CPDFSDK_PageView * pPageView
, 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView * pPageView, CP
DFSDK_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, point); | 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView * pPageView, C
PDFSDK_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,zDelta, poin
t); | 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown(CPDFSDK_PageView * pPageView,
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, point); | 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView * pPageView, CP
DFSDK_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, point); | 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 bool CPDFSDK_AnnotHandlerMgr::Annot_OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar
, 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 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_IsSHIF
TKeyDown(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->GetSDKDocument(); | 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* pAnnot, in
t nKeyCode, int nFlag) | 277 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKeyUp(CPDFSDK_Annot* pAnnot, int n
KeyCode, 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 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 pPage->GetSDKDocument(); | 291 pPage->GetSDKDocument(); |
| 292 return TRUE; | 292 return true; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 return FALSE; | 295 return false; |
| 296 } | 296 } |
| 297 | 297 |
| 298 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot
, FX_DWORD nFlag) | 298 bool CPDFSDK_AnnotHandlerMgr::Annot_OnKillFocus(CPDFSDK_Annot* pAnnot, F
X_DWORD nFlag) |
| 299 { | 299 { |
| 300 ASSERT(pAnnot); | 300 ASSERT(pAnnot); |
| 301 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 301 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 302 return pAnnotHandler->OnKillFocus(pAnnot, nFlag); | 302 return pAnnotHandler->OnKillFocus(pAnnot, nFlag); |
| 303 | 303 |
| 304 return FALSE; | 304 return false; |
| 305 } | 305 } |
| 306 | 306 |
| 307 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
View, CPDFSDK_Annot* pAnnot) | 307 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox(CPDFSDK_PageView *pPage
View, CPDFSDK_Annot* pAnnot) |
| 308 { | 308 { |
| 309 ASSERT(pAnnot); | 309 ASSERT(pAnnot); |
| 310 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 310 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 311 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); | 311 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); |
| 312 | 312 |
| 313 return pAnnot->GetRect(); | 313 return pAnnot->GetRect(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CP
DFSDK_Annot* pAnnot, const CPDF_Point& point) | 316 bool CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, const CPDF_Point& point) |
| 317 { | 317 { |
| 318 ASSERT(pAnnot); | 318 ASSERT(pAnnot); |
| 319 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 319 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 320 { | 320 { |
| 321 if (pAnnotHandler->CanAnswer(pAnnot)) | 321 if (pAnnotHandler->CanAnswer(pAnnot)) |
| 322 return pAnnotHandler->HitTest(pPageView, pAnnot, point); | 322 return pAnnotHandler->HitTest(pPageView, pAnnot, point); |
| 323 } | 323 } |
| 324 return FALSE; | 324 return false; |
| 325 } | 325 } |
| 326 | 326 |
| 327 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,F
X_BOOL bNext) | 327 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,b
ool bNext) |
| 328 { | 328 { |
| 329 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); | 329 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", ""); |
| 330 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 330 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
| 331 } | 331 } |
| 332 | 332 |
| 333 FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) | 333 bool CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) |
| 334 { | 334 { |
| 335 ASSERT(pAnnot->GetType() == "Widget"); | 335 ASSERT(pAnnot->GetType() == "Widget"); |
| 336 if (pAnnot->GetSubType() == BFFT_SIGNATURE) | 336 if (pAnnot->GetSubType() == BFFT_SIGNATURE) |
| 337 return FALSE; | 337 return false; |
| 338 | 338 |
| 339 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 339 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 340 if (!pWidget->IsVisible()) | 340 if (!pWidget->IsVisible()) |
| 341 return FALSE; | 341 return false; |
| 342 | 342 |
| 343 int nFieldFlags = pWidget->GetFieldFlags(); | 343 int nFieldFlags = pWidget->GetFieldFlags(); |
| 344 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 344 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
| 345 return FALSE; | 345 return false; |
| 346 | 346 |
| 347 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 347 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 348 return TRUE; | 348 return true; |
| 349 | 349 |
| 350 CPDF_Page* pPage = pWidget->GetPDFPage(); | 350 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 351 CPDF_Document* pDocument = pPage->m_pDocument; | 351 CPDF_Document* pDocument = pPage->m_pDocument; |
| 352 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | 352 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| 353 return (dwPermissions & FPDFPERM_FILL_FORM) || | 353 return (dwPermissions & FPDFPERM_FILL_FORM) || |
| 354 (dwPermissions & FPDFPERM_ANNOT_FORM); | 354 (dwPermissions & FPDFPERM_ANNOT_FORM); |
| 355 } | 355 } |
| 356 | 356 |
| 357 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Page
View* pPage) | 357 CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_Page
View* pPage) |
| 358 { | 358 { |
| 359 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); | 359 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
| 360 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); | 360 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pSDKDoc->GetInterForm(); |
| 361 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInte
rForm(), pAnnot->GetAnnotDict()); | 361 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl(pInterForm->GetInte
rForm(), pAnnot->GetAnnotDict()); |
| 362 if (!pCtrl) | 362 if (!pCtrl) |
| 363 return nullptr; | 363 return nullptr; |
| 364 | 364 |
| 365 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 365 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
| 366 pInterForm->AddMap(pCtrl, pWidget); | 366 pInterForm->AddMap(pCtrl, pWidget); |
| 367 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 367 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
| 368 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 368 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
| 369 pWidget->ResetAppearance(nullptr, FALSE); | 369 pWidget->ResetAppearance(nullptr, false); |
| 370 | 370 |
| 371 return pWidget; | 371 return pWidget; |
| 372 } | 372 } |
| 373 | 373 |
| 374 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) | 374 void CPDFSDK_BFAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) |
| 375 { | 375 { |
| 376 ASSERT(pAnnot != NULL); | 376 ASSERT(pAnnot != NULL); |
| 377 | 377 |
| 378 if (m_pFormFiller) | 378 if (m_pFormFiller) |
| 379 m_pFormFiller->OnDelete(pAnnot); | 379 m_pFormFiller->OnDelete(pAnnot); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 if (sSubType == BFFT_SIGNATURE) | 432 if (sSubType == BFFT_SIGNATURE) |
| 433 { | 433 { |
| 434 } | 434 } |
| 435 else | 435 else |
| 436 { | 436 { |
| 437 if (m_pFormFiller) | 437 if (m_pFormFiller) |
| 438 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); | 438 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } | 441 } |
| 442 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 442 bool CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_
Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 443 { | 443 { |
| 444 ASSERT(pAnnot != NULL); | 444 ASSERT(pAnnot != NULL); |
| 445 CFX_ByteString sSubType = pAnnot->GetSubType(); | 445 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 446 | 446 |
| 447 if (sSubType == BFFT_SIGNATURE) | 447 if (sSubType == BFFT_SIGNATURE) |
| 448 { | 448 { |
| 449 } | 449 } |
| 450 else | 450 else |
| 451 { | 451 { |
| 452 if (m_pFormFiller) | 452 if (m_pFormFiller) |
| 453 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point
); | 453 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point
); |
| 454 } | 454 } |
| 455 | 455 |
| 456 return FALSE; | 456 return false; |
| 457 } | 457 } |
| 458 | 458 |
| 459 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 459 bool CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 460 { | 460 { |
| 461 ASSERT(pAnnot != NULL); | 461 ASSERT(pAnnot != NULL); |
| 462 CFX_ByteString sSubType = pAnnot->GetSubType(); | 462 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 463 | 463 |
| 464 if (sSubType == BFFT_SIGNATURE) | 464 if (sSubType == BFFT_SIGNATURE) |
| 465 { | 465 { |
| 466 } | 466 } |
| 467 else | 467 else |
| 468 { | 468 { |
| 469 if (m_pFormFiller) | 469 if (m_pFormFiller) |
| 470 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 470 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 471 } | 471 } |
| 472 | 472 |
| 473 return FALSE; | 473 return false; |
| 474 } | 474 } |
| 475 | 475 |
| 476 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPD
FSDK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 476 bool CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 477 { | 477 { |
| 478 ASSERT(pAnnot != NULL); | 478 ASSERT(pAnnot != NULL); |
| 479 CFX_ByteString sSubType = pAnnot->GetSubType(); | 479 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 480 | 480 |
| 481 if (sSubType == BFFT_SIGNATURE) | 481 if (sSubType == BFFT_SIGNATURE) |
| 482 { | 482 { |
| 483 } | 483 } |
| 484 else | 484 else |
| 485 { | 485 { |
| 486 if (m_pFormFiller) | 486 if (m_pFormFiller) |
| 487 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, poi
nt); | 487 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, poi
nt); |
| 488 } | 488 } |
| 489 | 489 |
| 490 return FALSE; | 490 return false; |
| 491 } | 491 } |
| 492 | 492 |
| 493 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 493 bool CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 494 { | 494 { |
| 495 ASSERT(pAnnot != NULL); | 495 ASSERT(pAnnot != NULL); |
| 496 CFX_ByteString sSubType = pAnnot->GetSubType(); | 496 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 497 | 497 |
| 498 if (sSubType == BFFT_SIGNATURE) | 498 if (sSubType == BFFT_SIGNATURE) |
| 499 { | 499 { |
| 500 } | 500 } |
| 501 else | 501 else |
| 502 { | 502 { |
| 503 if (m_pFormFiller) | 503 if (m_pFormFiller) |
| 504 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 504 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 505 } | 505 } |
| 506 | 506 |
| 507 return FALSE; | 507 return false; |
| 508 | 508 |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSD
K_Annot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) | 512 bool CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_A
nnot* pAnnot, FX_DWORD nFlags, short zDelta, const CPDF_Point& point) |
| 513 { | 513 { |
| 514 ASSERT(pAnnot != NULL); | 514 ASSERT(pAnnot != NULL); |
| 515 CFX_ByteString sSubType = pAnnot->GetSubType(); | 515 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 516 | 516 |
| 517 if (sSubType == BFFT_SIGNATURE) | 517 if (sSubType == BFFT_SIGNATURE) |
| 518 { | 518 { |
| 519 } | 519 } |
| 520 else | 520 else |
| 521 { | 521 { |
| 522 if (m_pFormFiller) | 522 if (m_pFormFiller) |
| 523 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta
,point); | 523 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta
,point); |
| 524 } | 524 } |
| 525 | 525 |
| 526 return FALSE; | 526 return false; |
| 527 } | 527 } |
| 528 | 528 |
| 529 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 529 bool CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_
Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 530 { | 530 { |
| 531 ASSERT(pAnnot != NULL); | 531 ASSERT(pAnnot != NULL); |
| 532 CFX_ByteString sSubType = pAnnot->GetSubType(); | 532 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 533 | 533 |
| 534 if (sSubType == BFFT_SIGNATURE) | 534 if (sSubType == BFFT_SIGNATURE) |
| 535 { | 535 { |
| 536 } | 536 } |
| 537 else | 537 else |
| 538 { | 538 { |
| 539 if (m_pFormFiller) | 539 if (m_pFormFiller) |
| 540 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point
); | 540 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point
); |
| 541 } | 541 } |
| 542 | 542 |
| 543 return FALSE; | 543 return false; |
| 544 } | 544 } |
| 545 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK
_Annot* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) | 545 bool CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_An
not* pAnnot, FX_DWORD nFlags, const CPDF_Point& point) |
| 546 { | 546 { |
| 547 ASSERT(pAnnot != NULL); | 547 ASSERT(pAnnot != NULL); |
| 548 CFX_ByteString sSubType = pAnnot->GetSubType(); | 548 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 549 | 549 |
| 550 if (sSubType == BFFT_SIGNATURE) | 550 if (sSubType == BFFT_SIGNATURE) |
| 551 { | 551 { |
| 552 } | 552 } |
| 553 else | 553 else |
| 554 { | 554 { |
| 555 if (m_pFormFiller) | 555 if (m_pFormFiller) |
| 556 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 556 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 557 } | 557 } |
| 558 | 558 |
| 559 return FALSE; | 559 return false; |
| 560 } | 560 } |
| 561 | 561 |
| 562 FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX
_DWORD nFlags) | 562 bool CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, FX_DWORD nChar, FX_DW
ORD nFlags) |
| 563 { | 563 { |
| 564 ASSERT(pAnnot != NULL); | 564 ASSERT(pAnnot != NULL); |
| 565 CFX_ByteString sSubType = pAnnot->GetSubType(); | 565 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 566 | 566 |
| 567 if (sSubType == BFFT_SIGNATURE) | 567 if (sSubType == BFFT_SIGNATURE) |
| 568 { | 568 { |
| 569 } | 569 } |
| 570 else | 570 else |
| 571 { | 571 { |
| 572 if (m_pFormFiller) | 572 if (m_pFormFiller) |
| 573 return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); | 573 return m_pFormFiller->OnChar(pAnnot,nChar, nFlags); |
| 574 } | 574 } |
| 575 | 575 |
| 576 return FALSE; | 576 return false; |
| 577 } | 577 } |
| 578 | 578 |
| 579 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, i
nt nFlag) | 579 bool CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) |
| 580 { | 580 { |
| 581 ASSERT(pAnnot != NULL); | 581 ASSERT(pAnnot != NULL); |
| 582 CFX_ByteString sSubType = pAnnot->GetSubType(); | 582 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 583 | 583 |
| 584 if (sSubType == BFFT_SIGNATURE) | 584 if (sSubType == BFFT_SIGNATURE) |
| 585 { | 585 { |
| 586 } | 586 } |
| 587 else | 587 else |
| 588 { | 588 { |
| 589 if (m_pFormFiller) | 589 if (m_pFormFiller) |
| 590 return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); | 590 return m_pFormFiller->OnKeyDown(pAnnot,nKeyCode, nFlag); |
| 591 } | 591 } |
| 592 | 592 |
| 593 return FALSE; | 593 return false; |
| 594 } | 594 } |
| 595 | 595 |
| 596 FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int
nFlag) | 596 bool CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nF
lag) |
| 597 { | 597 { |
| 598 | 598 |
| 599 return FALSE; | 599 return false; |
| 600 } | 600 } |
| 601 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) | 601 void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) |
| 602 { | 602 { |
| 603 ASSERT(pAnnot != NULL); | 603 ASSERT(pAnnot != NULL); |
| 604 CFX_ByteString sSubType = pAnnot->GetSubType(); | 604 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 605 | 605 |
| 606 if (sSubType == BFFT_SIGNATURE) | 606 if (sSubType == BFFT_SIGNATURE) |
| 607 { | 607 { |
| 608 } | 608 } |
| 609 else | 609 else |
| 610 { | 610 { |
| 611 if (m_pFormFiller) | 611 if (m_pFormFiller) |
| 612 m_pFormFiller->OnCreate(pAnnot); | 612 m_pFormFiller->OnCreate(pAnnot); |
| 613 } | 613 } |
| 614 } | 614 } |
| 615 | 615 |
| 616 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) | 616 void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) |
| 617 { | 617 { |
| 618 ASSERT(pAnnot != NULL); | 618 ASSERT(pAnnot != NULL); |
| 619 | 619 |
| 620 CFX_ByteString sSubType = pAnnot->GetSubType(); | 620 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 621 | 621 |
| 622 if (sSubType == BFFT_SIGNATURE) | 622 if (sSubType == BFFT_SIGNATURE) |
| 623 { | 623 { |
| 624 } | 624 } |
| 625 else | 625 else |
| 626 { | 626 { |
| 627 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 627 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 628 if (!pWidget->IsAppearanceValid()) | 628 if (!pWidget->IsAppearanceValid()) |
| 629 pWidget->ResetAppearance(NULL, FALSE); | 629 pWidget->ResetAppearance(NULL, false); |
| 630 | 630 |
| 631 int nFieldType = pWidget->GetFieldType(); | 631 int nFieldType = pWidget->GetFieldType(); |
| 632 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBO
X) | 632 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBO
X) |
| 633 { | 633 { |
| 634 FX_BOOL bFormated = FALSE; | 634 bool bFormated = false; |
| 635 CFX_WideString sValue = pWidget->OnFormat(bFormated); | 635 CFX_WideString sValue = pWidget->OnFormat(bFormated); |
| 636 if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) | 636 if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) |
| 637 { | 637 { |
| 638 pWidget->ResetAppearance(sValue.c_str(), FALSE); | 638 pWidget->ResetAppearance(sValue.c_str(), false); |
| 639 } | 639 } |
| 640 } | 640 } |
| 641 | 641 |
| 642 if (m_pFormFiller) | 642 if (m_pFormFiller) |
| 643 m_pFormFiller->OnLoad(pAnnot); | 643 m_pFormFiller->OnLoad(pAnnot); |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 | 646 |
| 647 FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag
) | 647 bool CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
| 648 { | 648 { |
| 649 ASSERT(pAnnot != NULL); | 649 ASSERT(pAnnot != NULL); |
| 650 CFX_ByteString sSubType = pAnnot->GetSubType(); | 650 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 651 | 651 |
| 652 if (sSubType == BFFT_SIGNATURE) | 652 if (sSubType == BFFT_SIGNATURE) |
| 653 { | 653 { |
| 654 } | 654 } |
| 655 else | 655 else |
| 656 { | 656 { |
| 657 if (m_pFormFiller) | 657 if (m_pFormFiller) |
| 658 return m_pFormFiller->OnSetFocus(pAnnot,nFlag); | 658 return m_pFormFiller->OnSetFocus(pAnnot,nFlag); |
| 659 } | 659 } |
| 660 | 660 |
| 661 return TRUE; | 661 return true; |
| 662 } | 662 } |
| 663 FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFla
g) | 663 bool CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_DWORD nFlag) |
| 664 { | 664 { |
| 665 ASSERT(pAnnot != NULL); | 665 ASSERT(pAnnot != NULL); |
| 666 CFX_ByteString sSubType = pAnnot->GetSubType(); | 666 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 667 | 667 |
| 668 if (sSubType == BFFT_SIGNATURE) | 668 if (sSubType == BFFT_SIGNATURE) |
| 669 { | 669 { |
| 670 } | 670 } |
| 671 else | 671 else |
| 672 { | 672 { |
| 673 if (m_pFormFiller) | 673 if (m_pFormFiller) |
| 674 return m_pFormFiller->OnKillFocus(pAnnot,nFlag); | 674 return m_pFormFiller->OnKillFocus(pAnnot,nFlag); |
| 675 } | 675 } |
| 676 | 676 |
| 677 return TRUE; | 677 return true; |
| 678 } | 678 } |
| 679 | 679 |
| 680 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) | 680 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFS
DK_Annot* pAnnot) |
| 681 { | 681 { |
| 682 ASSERT(pAnnot != NULL); | 682 ASSERT(pAnnot != NULL); |
| 683 CFX_ByteString sSubType = pAnnot->GetSubType(); | 683 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 684 | 684 |
| 685 if (sSubType == BFFT_SIGNATURE) | 685 if (sSubType == BFFT_SIGNATURE) |
| 686 { | 686 { |
| 687 } | 687 } |
| 688 else | 688 else |
| 689 { | 689 { |
| 690 if (m_pFormFiller) | 690 if (m_pFormFiller) |
| 691 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); | 691 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); |
| 692 | 692 |
| 693 } | 693 } |
| 694 | 694 |
| 695 return CPDF_Rect(0,0,0,0); | 695 return CPDF_Rect(0,0,0,0); |
| 696 } | 696 } |
| 697 | 697 |
| 698 FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Ann
ot* pAnnot, const CPDF_Point& point) | 698 bool CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView *pPageView, CPDFSDK_Annot*
pAnnot, const CPDF_Point& point) |
| 699 { | 699 { |
| 700 ASSERT(pPageView); | 700 ASSERT(pPageView); |
| 701 ASSERT(pAnnot); | 701 ASSERT(pAnnot); |
| 702 | 702 |
| 703 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); | 703 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); |
| 704 return rect.Contains(point.x, point.y); | 704 return rect.Contains(point.x, point.y); |
| 705 } | 705 } |
| 706 | 706 |
| 707 //CReader_AnnotIteratorEx | 707 //CReader_AnnotIteratorEx |
| 708 | 708 |
| 709 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,FX_BOO
L bReverse, | 709 CPDFSDK_AnnotIterator::CPDFSDK_AnnotIterator(CPDFSDK_PageView * pPageView,bool b
Reverse, |
| 710 FX_BOOL bIgnoreTopmost/*=FALSE*
/, | 710 bool bIgnoreTopmost/*=false*/, |
| 711 FX_BOOL bCircle/*=FALSE*/, | 711 bool bCircle/*=false*/, |
| 712 CFX_PtrArray *pList/*=NULL*/) | 712 CFX_PtrArray *pList/*=NULL*/) |
| 713 { | 713 { |
| 714 ASSERT(pPageView); | 714 ASSERT(pPageView); |
| 715 m_bReverse=bReverse; | 715 m_bReverse=bReverse; |
| 716 m_bIgnoreTopmost= bIgnoreTopmost; | 716 m_bIgnoreTopmost= bIgnoreTopmost; |
| 717 m_bCircle=bCircle; | 717 m_bCircle=bCircle; |
| 718 m_pIteratorAnnotList.RemoveAll(); | 718 m_pIteratorAnnotList.RemoveAll(); |
| 719 InitIteratorAnnotList(pPageView,pList); | 719 InitIteratorAnnotList(pPageView,pList); |
| 720 } | 720 } |
| 721 | 721 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 | 843 |
| 844 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) | 844 int LyOrderCompare(CPDFSDK_Annot* p1, CPDFSDK_Annot* p2) |
| 845 { | 845 { |
| 846 if (p1->GetLayoutOrder() < p2->GetLayoutOrder()) | 846 if (p1->GetLayoutOrder() < p2->GetLayoutOrder()) |
| 847 return -1; | 847 return -1; |
| 848 if (p1->GetLayoutOrder() > p2->GetLayoutOrder()) | 848 if (p1->GetLayoutOrder() > p2->GetLayoutOrder()) |
| 849 return 1; | 849 return 1; |
| 850 return 0; | 850 return 0; |
| 851 } | 851 } |
| 852 | 852 |
| 853 FX_BOOL CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView
,CFX_PtrArray * pAnnotList) | 853 bool CPDFSDK_AnnotIterator::InitIteratorAnnotList(CPDFSDK_PageView* pPageView,CF
X_PtrArray * pAnnotList) |
| 854 { | 854 { |
| 855 ASSERT(pPageView); | 855 ASSERT(pPageView); |
| 856 | 856 |
| 857 if(pAnnotList==NULL){ | 857 if(pAnnotList==NULL){ |
| 858 pAnnotList=pPageView->GetAnnotList(); | 858 pAnnotList=pPageView->GetAnnotList(); |
| 859 } | 859 } |
| 860 | 860 |
| 861 m_pIteratorAnnotList.RemoveAll(); | 861 m_pIteratorAnnotList.RemoveAll(); |
| 862 if(!pAnnotList) return FALSE; | 862 if(!pAnnotList) return false; |
| 863 | 863 |
| 864 CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFoc
usAnnot(); | 864 CPDFSDK_Annot * pTopMostAnnot= (m_bIgnoreTopmost) ? NULL : pPageView->GetFoc
usAnnot(); |
| 865 | 865 |
| 866 | 866 |
| 867 int nCount =pAnnotList->GetSize(); | 867 int nCount =pAnnotList->GetSize(); |
| 868 | 868 |
| 869 for(int i = nCount- 1 ;i >= 0;i--) | 869 for(int i = nCount- 1 ;i >= 0;i--) |
| 870 { | 870 { |
| 871 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); | 871 CPDFSDK_Annot * pReaderAnnot= (CPDFSDK_Annot*)pAnnotList->GetAt(i); |
| 872 m_pIteratorAnnotList.Add(pReaderAnnot); | 872 m_pIteratorAnnotList.Add(pReaderAnnot); |
| 873 } | 873 } |
| 874 | 874 |
| 875 InsertSort(m_pIteratorAnnotList,&LyOrderCompare); | 875 InsertSort(m_pIteratorAnnotList,&LyOrderCompare); |
| 876 | 876 |
| 877 if(pTopMostAnnot) | 877 if(pTopMostAnnot) |
| 878 { | 878 { |
| 879 for(int i=0 ;i<nCount;i++) | 879 for(int i=0 ;i<nCount;i++) |
| 880 { | 880 { |
| 881 CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIteratorAnnotList.
GetAt(i); | 881 CPDFSDK_Annot * pReaderAnnot = (CPDFSDK_Annot*)m_pIteratorAnnotList.
GetAt(i); |
| 882 if(pReaderAnnot == pTopMostAnnot) | 882 if(pReaderAnnot == pTopMostAnnot) |
| 883 { | 883 { |
| 884 m_pIteratorAnnotList.RemoveAt(i); | 884 m_pIteratorAnnotList.RemoveAt(i); |
| 885 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); | 885 m_pIteratorAnnotList.InsertAt(0, pReaderAnnot); |
| 886 break; | 886 break; |
| 887 } | 887 } |
| 888 } | 888 } |
| 889 } | 889 } |
| 890 | 890 |
| 891 return TRUE; | 891 return true; |
| 892 } | 892 } |
| OLD | NEW |