| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/cpdfsdk_annothandlermgr.h" | 7 #include "fpdfsdk/cpdfsdk_annothandlermgr.h" |
| 8 | 8 |
| 9 #include "core/fpdfdoc/cpdf_annot.h" | 9 #include "core/fpdfdoc/cpdf_annot.h" |
| 10 #include "fpdfsdk/cba_annotiterator.h" | 10 #include "fpdfsdk/cba_annotiterator.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 ASSERT(pAnnot); | 49 ASSERT(pAnnot); |
| 50 ASSERT(pPageView); | 50 ASSERT(pPageView); |
| 51 | 51 |
| 52 return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET) | 52 return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET) |
| 53 ->NewAnnot(pAnnot, pPageView); | 53 ->NewAnnot(pAnnot, pPageView); |
| 54 } | 54 } |
| 55 #endif // PDF_ENABLE_XFA | 55 #endif // PDF_ENABLE_XFA |
| 56 | 56 |
| 57 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 57 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
| 58 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); | 58 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); |
| 59 pAnnotHandler->OnRelease(pAnnot); | |
| 60 pAnnotHandler->ReleaseAnnot(pAnnot); | 59 pAnnotHandler->ReleaseAnnot(pAnnot); |
| 61 } | 60 } |
| 62 | 61 |
| 63 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { | 62 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { |
| 64 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 63 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 65 | 64 |
| 66 CPDFSDK_DateTime curTime; | 65 CPDFSDK_DateTime curTime; |
| 67 pPDFAnnot->GetAnnotDict()->SetStringFor("M", curTime.ToPDFDateTimeString()); | 66 pPDFAnnot->GetAnnotDict()->SetStringFor("M", curTime.ToPDFDateTimeString()); |
| 68 pPDFAnnot->GetAnnotDict()->SetNumberFor("F", 0); | 67 pPDFAnnot->GetAnnotDict()->SetNumberFor("F", 0); |
| 69 | |
| 70 GetAnnotHandler(pAnnot)->OnCreate(pAnnot); | |
| 71 } | 68 } |
| 72 | 69 |
| 73 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { | 70 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { |
| 74 ASSERT(pAnnot); | 71 ASSERT(pAnnot); |
| 75 GetAnnotHandler(pAnnot)->OnLoad(pAnnot); | 72 GetAnnotHandler(pAnnot)->OnLoad(pAnnot); |
| 76 } | 73 } |
| 77 | 74 |
| 78 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( | 75 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
| 79 CPDFSDK_Annot* pAnnot) const { | 76 CPDFSDK_Annot* pAnnot) const { |
| 80 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); | 77 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 296 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
| 300 if (!hNextFocus && pSDKAnnot) | 297 if (!hNextFocus && pSDKAnnot) |
| 301 hNextFocus = pWidgetIterator->MoveToFirst(); | 298 hNextFocus = pWidgetIterator->MoveToFirst(); |
| 302 | 299 |
| 303 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 300 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
| 304 #else // PDF_ENABLE_XFA | 301 #else // PDF_ENABLE_XFA |
| 305 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); | 302 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); |
| 306 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 303 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
| 307 #endif // PDF_ENABLE_XFA | 304 #endif // PDF_ENABLE_XFA |
| 308 } | 305 } |
| OLD | NEW |