| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
| 10 #include "fpdfsdk/include/fsdk_annothandler.h" | 10 #include "fpdfsdk/include/fsdk_annothandler.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 #endif // PDF_ENABLE_XFA | 149 #endif // PDF_ENABLE_XFA |
| 150 static_cast<CPDFSDK_BAAnnot*>(pAnnot) | 150 static_cast<CPDFSDK_BAAnnot*>(pAnnot) |
| 151 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); | 151 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 | 154 |
| 155 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( | 155 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( |
| 156 CPDFSDK_PageView* pPageView, | 156 CPDFSDK_PageView* pPageView, |
| 157 CPDFSDK_Annot* pAnnot, | 157 CPDFSDK_Annot* pAnnot, |
| 158 FX_DWORD nFlags, | 158 FX_DWORD nFlags, |
| 159 const CPDF_Point& point) { | 159 const CFX_FloatPoint& point) { |
| 160 ASSERT(pAnnot); | 160 ASSERT(pAnnot); |
| 161 | 161 |
| 162 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 162 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 163 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); | 163 return pAnnotHandler->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
| 164 } | 164 } |
| 165 return FALSE; | 165 return FALSE; |
| 166 } | 166 } |
| 167 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp(CPDFSDK_PageView* pPageView, | 167 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonUp( |
| 168 CPDFSDK_Annot* pAnnot, | 168 CPDFSDK_PageView* pPageView, |
| 169 FX_DWORD nFlags, | 169 CPDFSDK_Annot* pAnnot, |
| 170 const CPDF_Point& point) { | 170 FX_DWORD nFlags, |
| 171 const CFX_FloatPoint& point) { |
| 171 ASSERT(pAnnot); | 172 ASSERT(pAnnot); |
| 172 | 173 |
| 173 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 174 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 174 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 175 return pAnnotHandler->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 175 } | 176 } |
| 176 return FALSE; | 177 return FALSE; |
| 177 } | 178 } |
| 178 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( | 179 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDblClk( |
| 179 CPDFSDK_PageView* pPageView, | 180 CPDFSDK_PageView* pPageView, |
| 180 CPDFSDK_Annot* pAnnot, | 181 CPDFSDK_Annot* pAnnot, |
| 181 FX_DWORD nFlags, | 182 FX_DWORD nFlags, |
| 182 const CPDF_Point& point) { | 183 const CFX_FloatPoint& point) { |
| 183 ASSERT(pAnnot); | 184 ASSERT(pAnnot); |
| 184 | 185 |
| 185 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 186 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 186 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 187 return pAnnotHandler->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 187 } | 188 } |
| 188 return FALSE; | 189 return FALSE; |
| 189 } | 190 } |
| 190 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove(CPDFSDK_PageView* pPageView, | 191 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseMove( |
| 191 CPDFSDK_Annot* pAnnot, | 192 CPDFSDK_PageView* pPageView, |
| 192 FX_DWORD nFlags, | 193 CPDFSDK_Annot* pAnnot, |
| 193 const CPDF_Point& point) { | 194 FX_DWORD nFlags, |
| 195 const CFX_FloatPoint& point) { |
| 194 ASSERT(pAnnot); | 196 ASSERT(pAnnot); |
| 195 | 197 |
| 196 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 198 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 197 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); | 199 return pAnnotHandler->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 198 } | 200 } |
| 199 return FALSE; | 201 return FALSE; |
| 200 } | 202 } |
| 201 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel(CPDFSDK_PageView* pPageView, | 203 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnMouseWheel( |
| 202 CPDFSDK_Annot* pAnnot, | 204 CPDFSDK_PageView* pPageView, |
| 203 FX_DWORD nFlags, | 205 CPDFSDK_Annot* pAnnot, |
| 204 short zDelta, | 206 FX_DWORD nFlags, |
| 205 const CPDF_Point& point) { | 207 short zDelta, |
| 208 const CFX_FloatPoint& point) { |
| 206 ASSERT(pAnnot); | 209 ASSERT(pAnnot); |
| 207 | 210 |
| 208 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 211 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 209 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, | 212 return pAnnotHandler->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, |
| 210 point); | 213 point); |
| 211 } | 214 } |
| 212 return FALSE; | 215 return FALSE; |
| 213 } | 216 } |
| 214 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( | 217 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonDown( |
| 215 CPDFSDK_PageView* pPageView, | 218 CPDFSDK_PageView* pPageView, |
| 216 CPDFSDK_Annot* pAnnot, | 219 CPDFSDK_Annot* pAnnot, |
| 217 FX_DWORD nFlags, | 220 FX_DWORD nFlags, |
| 218 const CPDF_Point& point) { | 221 const CFX_FloatPoint& point) { |
| 219 ASSERT(pAnnot); | 222 ASSERT(pAnnot); |
| 220 | 223 |
| 221 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 224 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 222 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 225 return pAnnotHandler->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 223 } | 226 } |
| 224 return FALSE; | 227 return FALSE; |
| 225 } | 228 } |
| 226 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp(CPDFSDK_PageView* pPageView, | 229 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnRButtonUp( |
| 227 CPDFSDK_Annot* pAnnot, | 230 CPDFSDK_PageView* pPageView, |
| 228 FX_DWORD nFlags, | 231 CPDFSDK_Annot* pAnnot, |
| 229 const CPDF_Point& point) { | 232 FX_DWORD nFlags, |
| 233 const CFX_FloatPoint& point) { |
| 230 ASSERT(pAnnot); | 234 ASSERT(pAnnot); |
| 231 | 235 |
| 232 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 236 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 233 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 237 return pAnnotHandler->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 234 } | 238 } |
| 235 return FALSE; | 239 return FALSE; |
| 236 } | 240 } |
| 237 | 241 |
| 238 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, | 242 void CPDFSDK_AnnotHandlerMgr::Annot_OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 239 CPDFSDK_Annot* pAnnot, | 243 CPDFSDK_Annot* pAnnot, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (bXFA) { | 328 if (bXFA) { |
| 325 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = | 329 if (IPDFSDK_AnnotHandler* pXFAAnnotHandler = |
| 326 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) | 330 GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)) |
| 327 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); | 331 return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot); |
| 328 } | 332 } |
| 329 | 333 |
| 330 return TRUE; | 334 return TRUE; |
| 331 } | 335 } |
| 332 #endif // PDF_ENABLE_XFA | 336 #endif // PDF_ENABLE_XFA |
| 333 | 337 |
| 334 CPDF_Rect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( | 338 CFX_FloatRect CPDFSDK_AnnotHandlerMgr::Annot_OnGetViewBBox( |
| 335 CPDFSDK_PageView* pPageView, | 339 CPDFSDK_PageView* pPageView, |
| 336 CPDFSDK_Annot* pAnnot) { | 340 CPDFSDK_Annot* pAnnot) { |
| 337 ASSERT(pAnnot); | 341 ASSERT(pAnnot); |
| 338 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) | 342 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) |
| 339 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); | 343 return pAnnotHandler->GetViewBBox(pPageView, pAnnot); |
| 340 | 344 |
| 341 return pAnnot->GetRect(); | 345 return pAnnot->GetRect(); |
| 342 } | 346 } |
| 343 | 347 |
| 344 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, | 348 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnHitTest(CPDFSDK_PageView* pPageView, |
| 345 CPDFSDK_Annot* pAnnot, | 349 CPDFSDK_Annot* pAnnot, |
| 346 const CPDF_Point& point) { | 350 const CFX_FloatPoint& point) { |
| 347 ASSERT(pAnnot); | 351 ASSERT(pAnnot); |
| 348 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 352 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
| 349 if (pAnnotHandler->CanAnswer(pAnnot)) | 353 if (pAnnotHandler->CanAnswer(pAnnot)) |
| 350 return pAnnotHandler->HitTest(pPageView, pAnnot, point); | 354 return pAnnotHandler->HitTest(pPageView, pAnnot, point); |
| 351 } | 355 } |
| 352 return FALSE; | 356 return FALSE; |
| 353 } | 357 } |
| 354 | 358 |
| 355 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, | 359 CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, |
| 356 FX_BOOL bNext) { | 360 FX_BOOL bNext) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 | 490 |
| 487 if (sSubType == BFFT_SIGNATURE) { | 491 if (sSubType == BFFT_SIGNATURE) { |
| 488 } else { | 492 } else { |
| 489 if (m_pFormFiller) | 493 if (m_pFormFiller) |
| 490 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); | 494 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); |
| 491 } | 495 } |
| 492 } | 496 } |
| 493 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, | 497 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 494 CPDFSDK_Annot* pAnnot, | 498 CPDFSDK_Annot* pAnnot, |
| 495 FX_DWORD nFlags, | 499 FX_DWORD nFlags, |
| 496 const CPDF_Point& point) { | 500 const CFX_FloatPoint& point) { |
| 497 CFX_ByteString sSubType = pAnnot->GetSubType(); | 501 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 498 | 502 |
| 499 if (sSubType == BFFT_SIGNATURE) { | 503 if (sSubType == BFFT_SIGNATURE) { |
| 500 } else { | 504 } else { |
| 501 if (m_pFormFiller) | 505 if (m_pFormFiller) |
| 502 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); | 506 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
| 503 } | 507 } |
| 504 | 508 |
| 505 return FALSE; | 509 return FALSE; |
| 506 } | 510 } |
| 507 | 511 |
| 508 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, | 512 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 509 CPDFSDK_Annot* pAnnot, | 513 CPDFSDK_Annot* pAnnot, |
| 510 FX_DWORD nFlags, | 514 FX_DWORD nFlags, |
| 511 const CPDF_Point& point) { | 515 const CFX_FloatPoint& point) { |
| 512 CFX_ByteString sSubType = pAnnot->GetSubType(); | 516 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 513 | 517 |
| 514 if (sSubType == BFFT_SIGNATURE) { | 518 if (sSubType == BFFT_SIGNATURE) { |
| 515 } else { | 519 } else { |
| 516 if (m_pFormFiller) | 520 if (m_pFormFiller) |
| 517 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 521 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 518 } | 522 } |
| 519 | 523 |
| 520 return FALSE; | 524 return FALSE; |
| 521 } | 525 } |
| 522 | 526 |
| 523 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 527 FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 524 CPDFSDK_Annot* pAnnot, | 528 CPDFSDK_Annot* pAnnot, |
| 525 FX_DWORD nFlags, | 529 FX_DWORD nFlags, |
| 526 const CPDF_Point& point) { | 530 const CFX_FloatPoint& point) { |
| 527 CFX_ByteString sSubType = pAnnot->GetSubType(); | 531 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 528 | 532 |
| 529 if (sSubType == BFFT_SIGNATURE) { | 533 if (sSubType == BFFT_SIGNATURE) { |
| 530 } else { | 534 } else { |
| 531 if (m_pFormFiller) | 535 if (m_pFormFiller) |
| 532 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 536 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 533 } | 537 } |
| 534 | 538 |
| 535 return FALSE; | 539 return FALSE; |
| 536 } | 540 } |
| 537 | 541 |
| 538 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, | 542 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 539 CPDFSDK_Annot* pAnnot, | 543 CPDFSDK_Annot* pAnnot, |
| 540 FX_DWORD nFlags, | 544 FX_DWORD nFlags, |
| 541 const CPDF_Point& point) { | 545 const CFX_FloatPoint& point) { |
| 542 CFX_ByteString sSubType = pAnnot->GetSubType(); | 546 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 543 | 547 |
| 544 if (sSubType == BFFT_SIGNATURE) { | 548 if (sSubType == BFFT_SIGNATURE) { |
| 545 } else { | 549 } else { |
| 546 if (m_pFormFiller) | 550 if (m_pFormFiller) |
| 547 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 551 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 548 } | 552 } |
| 549 | 553 |
| 550 return FALSE; | 554 return FALSE; |
| 551 } | 555 } |
| 552 | 556 |
| 553 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, | 557 FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 554 CPDFSDK_Annot* pAnnot, | 558 CPDFSDK_Annot* pAnnot, |
| 555 FX_DWORD nFlags, | 559 FX_DWORD nFlags, |
| 556 short zDelta, | 560 short zDelta, |
| 557 const CPDF_Point& point) { | 561 const CFX_FloatPoint& point) { |
| 558 CFX_ByteString sSubType = pAnnot->GetSubType(); | 562 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 559 | 563 |
| 560 if (sSubType == BFFT_SIGNATURE) { | 564 if (sSubType == BFFT_SIGNATURE) { |
| 561 } else { | 565 } else { |
| 562 if (m_pFormFiller) | 566 if (m_pFormFiller) |
| 563 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, | 567 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, |
| 564 point); | 568 point); |
| 565 } | 569 } |
| 566 | 570 |
| 567 return FALSE; | 571 return FALSE; |
| 568 } | 572 } |
| 569 | 573 |
| 570 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, | 574 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 571 CPDFSDK_Annot* pAnnot, | 575 CPDFSDK_Annot* pAnnot, |
| 572 FX_DWORD nFlags, | 576 FX_DWORD nFlags, |
| 573 const CPDF_Point& point) { | 577 const CFX_FloatPoint& point) { |
| 574 CFX_ByteString sSubType = pAnnot->GetSubType(); | 578 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 575 | 579 |
| 576 if (sSubType == BFFT_SIGNATURE) { | 580 if (sSubType == BFFT_SIGNATURE) { |
| 577 } else { | 581 } else { |
| 578 if (m_pFormFiller) | 582 if (m_pFormFiller) |
| 579 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 583 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 580 } | 584 } |
| 581 | 585 |
| 582 return FALSE; | 586 return FALSE; |
| 583 } | 587 } |
| 584 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, | 588 FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 585 CPDFSDK_Annot* pAnnot, | 589 CPDFSDK_Annot* pAnnot, |
| 586 FX_DWORD nFlags, | 590 FX_DWORD nFlags, |
| 587 const CPDF_Point& point) { | 591 const CFX_FloatPoint& point) { |
| 588 CFX_ByteString sSubType = pAnnot->GetSubType(); | 592 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 589 | 593 |
| 590 if (sSubType == BFFT_SIGNATURE) { | 594 if (sSubType == BFFT_SIGNATURE) { |
| 591 } else { | 595 } else { |
| 592 if (m_pFormFiller) | 596 if (m_pFormFiller) |
| 593 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 597 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 594 } | 598 } |
| 595 | 599 |
| 596 return FALSE; | 600 return FALSE; |
| 597 } | 601 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 | 691 |
| 688 if (sSubType == BFFT_SIGNATURE) { | 692 if (sSubType == BFFT_SIGNATURE) { |
| 689 } else { | 693 } else { |
| 690 if (m_pFormFiller) | 694 if (m_pFormFiller) |
| 691 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); | 695 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); |
| 692 } | 696 } |
| 693 | 697 |
| 694 return TRUE; | 698 return TRUE; |
| 695 } | 699 } |
| 696 | 700 |
| 697 CPDF_Rect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 701 CFX_FloatRect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
| 698 CPDFSDK_Annot* pAnnot) { | 702 CPDFSDK_Annot* pAnnot) { |
| 699 CFX_ByteString sSubType = pAnnot->GetSubType(); | 703 CFX_ByteString sSubType = pAnnot->GetSubType(); |
| 700 | 704 |
| 701 if (sSubType == BFFT_SIGNATURE) { | 705 if (sSubType == BFFT_SIGNATURE) { |
| 702 } else { | 706 } else { |
| 703 if (m_pFormFiller) | 707 if (m_pFormFiller) |
| 704 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); | 708 return m_pFormFiller->GetViewBBox(pPageView, pAnnot); |
| 705 } | 709 } |
| 706 | 710 |
| 707 return CPDF_Rect(0, 0, 0, 0); | 711 return CFX_FloatRect(0, 0, 0, 0); |
| 708 } | 712 } |
| 709 | 713 |
| 710 FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, | 714 FX_BOOL CPDFSDK_BFAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, |
| 711 CPDFSDK_Annot* pAnnot, | 715 CPDFSDK_Annot* pAnnot, |
| 712 const CPDF_Point& point) { | 716 const CFX_FloatPoint& point) { |
| 713 ASSERT(pPageView); | 717 ASSERT(pPageView); |
| 714 ASSERT(pAnnot); | 718 ASSERT(pAnnot); |
| 715 | 719 |
| 716 CPDF_Rect rect = GetViewBBox(pPageView, pAnnot); | 720 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
| 717 return rect.Contains(point.x, point.y); | 721 return rect.Contains(point.x, point.y); |
| 718 } | 722 } |
| 719 | 723 |
| 720 #ifdef PDF_ENABLE_XFA | 724 #ifdef PDF_ENABLE_XFA |
| 721 #define FWL_WGTHITTEST_Unknown 0 | 725 #define FWL_WGTHITTEST_Unknown 0 |
| 722 #define FWL_WGTHITTEST_Client 1 // arrow | 726 #define FWL_WGTHITTEST_Client 1 // arrow |
| 723 #define FWL_WGTHITTEST_Titlebar 11 // caption | 727 #define FWL_WGTHITTEST_Titlebar 11 // caption |
| 724 #define FWL_WGTHITTEST_HScrollBar 15 | 728 #define FWL_WGTHITTEST_HScrollBar 15 |
| 725 #define FWL_WGTHITTEST_VScrollBar 16 | 729 #define FWL_WGTHITTEST_VScrollBar 16 |
| 726 #define FWL_WGTHITTEST_Border 17 | 730 #define FWL_WGTHITTEST_Border 17 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 } | 774 } |
| 771 | 775 |
| 772 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 776 void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
| 773 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; | 777 CPDFSDK_XFAWidget* pWidget = (CPDFSDK_XFAWidget*)pAnnot; |
| 774 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); | 778 CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm(); |
| 775 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); | 779 pInterForm->RemoveXFAMap(pWidget->GetXFAWidget()); |
| 776 | 780 |
| 777 delete pWidget; | 781 delete pWidget; |
| 778 } | 782 } |
| 779 | 783 |
| 780 CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 784 CFX_FloatRect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
| 781 CPDFSDK_Annot* pAnnot) { | 785 CPDFSDK_Annot* pAnnot) { |
| 782 ASSERT(pAnnot); | 786 ASSERT(pAnnot); |
| 783 | 787 |
| 784 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 788 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 785 CFX_RectF rcBBox; | 789 CFX_RectF rcBBox; |
| 786 XFA_ELEMENT eType = | 790 XFA_ELEMENT eType = |
| 787 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); | 791 pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType(); |
| 788 if (eType == XFA_ELEMENT_Signature) | 792 if (eType == XFA_ELEMENT_Signature) |
| 789 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, | 793 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, |
| 790 XFA_WIDGETSTATUS_Visible, TRUE); | 794 XFA_WIDGETSTATUS_Visible, TRUE); |
| 791 else | 795 else |
| 792 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); | 796 pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0); |
| 793 | 797 |
| 794 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, | 798 CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
| 795 rcBBox.top + rcBBox.height); | 799 rcBBox.top + rcBBox.height); |
| 796 rcWidget.left -= 1.0f; | 800 rcWidget.left -= 1.0f; |
| 797 rcWidget.right += 1.0f; | 801 rcWidget.right += 1.0f; |
| 798 rcWidget.bottom -= 1.0f; | 802 rcWidget.bottom -= 1.0f; |
| 799 rcWidget.top += 1.0f; | 803 rcWidget.top += 1.0f; |
| 800 | 804 |
| 801 return rcWidget; | 805 return rcWidget; |
| 802 } | 806 } |
| 803 | 807 |
| 804 FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, | 808 FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, |
| 805 CPDFSDK_Annot* pAnnot, | 809 CPDFSDK_Annot* pAnnot, |
| 806 const CPDF_Point& point) { | 810 const CFX_FloatPoint& point) { |
| 807 if (!pPageView || !pAnnot) | 811 if (!pPageView || !pAnnot) |
| 808 return FALSE; | 812 return FALSE; |
| 809 | 813 |
| 810 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 814 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
| 811 if (!pSDKDoc) | 815 if (!pSDKDoc) |
| 812 return FALSE; | 816 return FALSE; |
| 813 | 817 |
| 814 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); | 818 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); |
| 815 if (!pDoc) | 819 if (!pDoc) |
| 816 return FALSE; | 820 return FALSE; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 843 if (!pPageView || !pAnnot) | 847 if (!pPageView || !pAnnot) |
| 844 return; | 848 return; |
| 845 | 849 |
| 846 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 850 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 847 pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); | 851 pWidgetHandler->OnMouseExit(pAnnot->GetXFAWidget()); |
| 848 } | 852 } |
| 849 | 853 |
| 850 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, | 854 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 851 CPDFSDK_Annot* pAnnot, | 855 CPDFSDK_Annot* pAnnot, |
| 852 FX_DWORD nFlags, | 856 FX_DWORD nFlags, |
| 853 const CPDF_Point& point) { | 857 const CFX_FloatPoint& point) { |
| 854 if (!pPageView || !pAnnot) | 858 if (!pPageView || !pAnnot) |
| 855 return FALSE; | 859 return FALSE; |
| 856 | 860 |
| 857 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 861 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 858 return pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), | 862 return pWidgetHandler->OnLButtonDown(pAnnot->GetXFAWidget(), |
| 859 GetFWLFlags(nFlags), point.x, point.y); | 863 GetFWLFlags(nFlags), point.x, point.y); |
| 860 } | 864 } |
| 861 | 865 |
| 862 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, | 866 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 863 CPDFSDK_Annot* pAnnot, | 867 CPDFSDK_Annot* pAnnot, |
| 864 FX_DWORD nFlags, | 868 FX_DWORD nFlags, |
| 865 const CPDF_Point& point) { | 869 const CFX_FloatPoint& point) { |
| 866 if (!pPageView || !pAnnot) | 870 if (!pPageView || !pAnnot) |
| 867 return FALSE; | 871 return FALSE; |
| 868 | 872 |
| 869 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 873 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 870 return pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), | 874 return pWidgetHandler->OnLButtonUp(pAnnot->GetXFAWidget(), |
| 871 GetFWLFlags(nFlags), point.x, point.y); | 875 GetFWLFlags(nFlags), point.x, point.y); |
| 872 } | 876 } |
| 873 | 877 |
| 874 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 878 FX_BOOL CPDFSDK_XFAAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 875 CPDFSDK_Annot* pAnnot, | 879 CPDFSDK_Annot* pAnnot, |
| 876 FX_DWORD nFlags, | 880 FX_DWORD nFlags, |
| 877 const CPDF_Point& point) { | 881 const CFX_FloatPoint& point) { |
| 878 if (!pPageView || !pAnnot) | 882 if (!pPageView || !pAnnot) |
| 879 return FALSE; | 883 return FALSE; |
| 880 | 884 |
| 881 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 885 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 882 return pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), | 886 return pWidgetHandler->OnLButtonDblClk(pAnnot->GetXFAWidget(), |
| 883 GetFWLFlags(nFlags), point.x, point.y); | 887 GetFWLFlags(nFlags), point.x, point.y); |
| 884 } | 888 } |
| 885 | 889 |
| 886 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, | 890 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 887 CPDFSDK_Annot* pAnnot, | 891 CPDFSDK_Annot* pAnnot, |
| 888 FX_DWORD nFlags, | 892 FX_DWORD nFlags, |
| 889 const CPDF_Point& point) { | 893 const CFX_FloatPoint& point) { |
| 890 if (!pPageView || !pAnnot) | 894 if (!pPageView || !pAnnot) |
| 891 return FALSE; | 895 return FALSE; |
| 892 | 896 |
| 893 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 897 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 894 return pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), | 898 return pWidgetHandler->OnMouseMove(pAnnot->GetXFAWidget(), |
| 895 GetFWLFlags(nFlags), point.x, point.y); | 899 GetFWLFlags(nFlags), point.x, point.y); |
| 896 } | 900 } |
| 897 | 901 |
| 898 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, | 902 FX_BOOL CPDFSDK_XFAAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 899 CPDFSDK_Annot* pAnnot, | 903 CPDFSDK_Annot* pAnnot, |
| 900 FX_DWORD nFlags, | 904 FX_DWORD nFlags, |
| 901 short zDelta, | 905 short zDelta, |
| 902 const CPDF_Point& point) { | 906 const CFX_FloatPoint& point) { |
| 903 if (!pPageView || !pAnnot) | 907 if (!pPageView || !pAnnot) |
| 904 return FALSE; | 908 return FALSE; |
| 905 | 909 |
| 906 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 910 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 907 return pWidgetHandler->OnMouseWheel( | 911 return pWidgetHandler->OnMouseWheel( |
| 908 pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y); | 912 pAnnot->GetXFAWidget(), GetFWLFlags(nFlags), zDelta, point.x, point.y); |
| 909 } | 913 } |
| 910 | 914 |
| 911 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, | 915 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 912 CPDFSDK_Annot* pAnnot, | 916 CPDFSDK_Annot* pAnnot, |
| 913 FX_DWORD nFlags, | 917 FX_DWORD nFlags, |
| 914 const CPDF_Point& point) { | 918 const CFX_FloatPoint& point) { |
| 915 if (!pPageView || !pAnnot) | 919 if (!pPageView || !pAnnot) |
| 916 return FALSE; | 920 return FALSE; |
| 917 | 921 |
| 918 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 922 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 919 return pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), | 923 return pWidgetHandler->OnRButtonDown(pAnnot->GetXFAWidget(), |
| 920 GetFWLFlags(nFlags), point.x, point.y); | 924 GetFWLFlags(nFlags), point.x, point.y); |
| 921 } | 925 } |
| 922 | 926 |
| 923 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, | 927 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 924 CPDFSDK_Annot* pAnnot, | 928 CPDFSDK_Annot* pAnnot, |
| 925 FX_DWORD nFlags, | 929 FX_DWORD nFlags, |
| 926 const CPDF_Point& point) { | 930 const CFX_FloatPoint& point) { |
| 927 if (!pPageView || !pAnnot) | 931 if (!pPageView || !pAnnot) |
| 928 return FALSE; | 932 return FALSE; |
| 929 | 933 |
| 930 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 934 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 931 return pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), | 935 return pWidgetHandler->OnRButtonUp(pAnnot->GetXFAWidget(), |
| 932 GetFWLFlags(nFlags), point.x, point.y); | 936 GetFWLFlags(nFlags), point.x, point.y); |
| 933 } | 937 } |
| 934 | 938 |
| 935 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, | 939 FX_BOOL CPDFSDK_XFAAnnotHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 936 CPDFSDK_Annot* pAnnot, | 940 CPDFSDK_Annot* pAnnot, |
| 937 FX_DWORD nFlags, | 941 FX_DWORD nFlags, |
| 938 const CPDF_Point& point) { | 942 const CFX_FloatPoint& point) { |
| 939 if (!pPageView || !pAnnot) | 943 if (!pPageView || !pAnnot) |
| 940 return FALSE; | 944 return FALSE; |
| 941 | 945 |
| 942 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | 946 IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); |
| 943 return pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), | 947 return pWidgetHandler->OnRButtonDblClk(pAnnot->GetXFAWidget(), |
| 944 GetFWLFlags(nFlags), point.x, point.y); | 948 GetFWLFlags(nFlags), point.x, point.y); |
| 945 } | 949 } |
| 946 | 950 |
| 947 FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, | 951 FX_BOOL CPDFSDK_XFAAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot, |
| 948 FX_DWORD nChar, | 952 FX_DWORD nChar, |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 | 1103 |
| 1100 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { | 1104 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { |
| 1101 if (m_pos < m_iteratorAnnotList.size()) | 1105 if (m_pos < m_iteratorAnnotList.size()) |
| 1102 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; | 1106 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; |
| 1103 return nullptr; | 1107 return nullptr; |
| 1104 } | 1108 } |
| 1105 | 1109 |
| 1106 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { | 1110 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { |
| 1107 return m_bReverse ? PrevAnnot() : NextAnnot(); | 1111 return m_bReverse ? PrevAnnot() : NextAnnot(); |
| 1108 } | 1112 } |
| OLD | NEW |