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 "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
10 #include "../include/fsdk_mgr.h" | 10 #include "../include/fsdk_mgr.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const CFX_ByteString& sType) const { | 109 const CFX_ByteString& sType) const { |
110 auto it = m_mapType2Handler.find(sType); | 110 auto it = m_mapType2Handler.find(sType); |
111 return it != m_mapType2Handler.end() ? it->second : nullptr; | 111 return it != m_mapType2Handler.end() ? it->second : nullptr; |
112 } | 112 } |
113 | 113 |
114 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, | 114 void CPDFSDK_AnnotHandlerMgr::Annot_OnDraw(CPDFSDK_PageView* pPageView, |
115 CPDFSDK_Annot* pAnnot, | 115 CPDFSDK_Annot* pAnnot, |
116 CFX_RenderDevice* pDevice, | 116 CFX_RenderDevice* pDevice, |
117 CPDF_Matrix* pUser2Device, | 117 CPDF_Matrix* pUser2Device, |
118 FX_DWORD dwFlags) { | 118 FX_DWORD dwFlags) { |
119 ASSERT(pAnnot != NULL); | 119 ASSERT(pAnnot); |
120 | 120 |
121 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { | 121 if (IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot)) { |
122 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 122 pAnnotHandler->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
123 } else { | 123 } else { |
124 ((CPDFSDK_BAAnnot*)pAnnot) | 124 static_cast<CPDFSDK_BAAnnot*>(pAnnot) |
125 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 125 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
126 } | 126 } |
127 } | 127 } |
128 | 128 |
129 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( | 129 FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnLButtonDown( |
130 CPDFSDK_PageView* pPageView, | 130 CPDFSDK_PageView* pPageView, |
131 CPDFSDK_Annot* pAnnot, | 131 CPDFSDK_Annot* pAnnot, |
132 FX_DWORD nFlags, | 132 FX_DWORD nFlags, |
133 const CPDF_Point& point) { | 133 const CPDF_Point& point) { |
134 ASSERT(pAnnot != NULL); | 134 ASSERT(pAnnot != NULL); |
135 | 135 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 pInterForm->RemoveMap(pCtrol); | 374 pInterForm->RemoveMap(pCtrol); |
375 | 375 |
376 delete pWidget; | 376 delete pWidget; |
377 } | 377 } |
378 | 378 |
379 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, | 379 void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, |
380 CPDFSDK_Annot* pAnnot, | 380 CPDFSDK_Annot* pAnnot, |
381 CFX_RenderDevice* pDevice, | 381 CFX_RenderDevice* pDevice, |
382 CPDF_Matrix* pUser2Device, | 382 CPDF_Matrix* pUser2Device, |
383 FX_DWORD dwFlags) { | 383 FX_DWORD dwFlags) { |
384 ASSERT(pAnnot != NULL); | |
385 CFX_ByteString sSubType = pAnnot->GetSubType(); | 384 CFX_ByteString sSubType = pAnnot->GetSubType(); |
386 | 385 |
387 if (sSubType == BFFT_SIGNATURE) { | 386 if (sSubType == BFFT_SIGNATURE) { |
388 ((CPDFSDK_BAAnnot*)pAnnot) | 387 static_cast<CPDFSDK_BAAnnot*>(pAnnot) |
389 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 388 ->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); |
390 } else { | 389 } else { |
391 if (m_pFormFiller) { | 390 if (m_pFormFiller) { |
392 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 391 m_pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
393 } | 392 } |
394 } | 393 } |
395 } | 394 } |
396 | 395 |
397 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, | 396 void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView, |
398 CPDFSDK_Annot* pAnnot, | 397 CPDFSDK_Annot* pAnnot, |
399 FX_DWORD nFlag) { | 398 FX_DWORD nFlag) { |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 687 |
689 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { | 688 CPDFSDK_Annot* CPDFSDK_AnnotIterator::PrevAnnot() { |
690 if (m_pos < m_iteratorAnnotList.size()) | 689 if (m_pos < m_iteratorAnnotList.size()) |
691 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; | 690 return m_iteratorAnnotList[m_iteratorAnnotList.size() - ++m_pos]; |
692 return nullptr; | 691 return nullptr; |
693 } | 692 } |
694 | 693 |
695 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { | 694 CPDFSDK_Annot* CPDFSDK_AnnotIterator::Next() { |
696 return m_bReverse ? PrevAnnot() : NextAnnot(); | 695 return m_bReverse ? PrevAnnot() : NextAnnot(); |
697 } | 696 } |
OLD | NEW |