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/fpdfapi/parser/cpdf_number.h" |
| 10 #include "core/fpdfapi/parser/cpdf_string.h" |
9 #include "core/fpdfdoc/cpdf_annot.h" | 11 #include "core/fpdfdoc/cpdf_annot.h" |
10 #include "fpdfsdk/cba_annotiterator.h" | 12 #include "fpdfsdk/cba_annotiterator.h" |
11 #include "fpdfsdk/cpdfsdk_annot.h" | 13 #include "fpdfsdk/cpdfsdk_annot.h" |
12 #include "fpdfsdk/cpdfsdk_baannot.h" | 14 #include "fpdfsdk/cpdfsdk_baannot.h" |
13 #include "fpdfsdk/cpdfsdk_baannothandler.h" | 15 #include "fpdfsdk/cpdfsdk_baannothandler.h" |
14 #include "fpdfsdk/cpdfsdk_datetime.h" | 16 #include "fpdfsdk/cpdfsdk_datetime.h" |
15 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 17 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
16 #include "fpdfsdk/cpdfsdk_pageview.h" | 18 #include "fpdfsdk/cpdfsdk_pageview.h" |
17 #include "fpdfsdk/cpdfsdk_widgethandler.h" | 19 #include "fpdfsdk/cpdfsdk_widgethandler.h" |
18 | 20 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 57 |
56 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { | 58 void CPDFSDK_AnnotHandlerMgr::ReleaseAnnot(CPDFSDK_Annot* pAnnot) { |
57 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); | 59 IPDFSDK_AnnotHandler* pAnnotHandler = GetAnnotHandler(pAnnot); |
58 pAnnotHandler->ReleaseAnnot(pAnnot); | 60 pAnnotHandler->ReleaseAnnot(pAnnot); |
59 } | 61 } |
60 | 62 |
61 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { | 63 void CPDFSDK_AnnotHandlerMgr::Annot_OnCreate(CPDFSDK_Annot* pAnnot) { |
62 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 64 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
63 | 65 |
64 CPDFSDK_DateTime curTime; | 66 CPDFSDK_DateTime curTime; |
65 pPDFAnnot->GetAnnotDict()->SetStringFor("M", curTime.ToPDFDateTimeString()); | 67 pPDFAnnot->GetAnnotDict()->SetNewFor<CPDF_String>( |
66 pPDFAnnot->GetAnnotDict()->SetNumberFor("F", 0); | 68 "M", curTime.ToPDFDateTimeString(), false); |
| 69 pPDFAnnot->GetAnnotDict()->SetNewFor<CPDF_Number>("F", 0); |
67 } | 70 } |
68 | 71 |
69 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { | 72 void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { |
70 ASSERT(pAnnot); | 73 ASSERT(pAnnot); |
71 GetAnnotHandler(pAnnot)->OnLoad(pAnnot); | 74 GetAnnotHandler(pAnnot)->OnLoad(pAnnot); |
72 } | 75 } |
73 | 76 |
74 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( | 77 IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( |
75 CPDFSDK_Annot* pAnnot) const { | 78 CPDFSDK_Annot* pAnnot) const { |
76 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); | 79 return GetAnnotHandler(pAnnot->GetAnnotSubtype()); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); | 300 bNext ? pWidgetIterator->MoveToNext() : pWidgetIterator->MoveToPrevious(); |
298 if (!hNextFocus && pSDKAnnot) | 301 if (!hNextFocus && pSDKAnnot) |
299 hNextFocus = pWidgetIterator->MoveToFirst(); | 302 hNextFocus = pWidgetIterator->MoveToFirst(); |
300 | 303 |
301 return pPageView->GetAnnotByXFAWidget(hNextFocus); | 304 return pPageView->GetAnnotByXFAWidget(hNextFocus); |
302 #else // PDF_ENABLE_XFA | 305 #else // PDF_ENABLE_XFA |
303 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); | 306 CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET); |
304 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); | 307 return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot); |
305 #endif // PDF_ENABLE_XFA | 308 #endif // PDF_ENABLE_XFA |
306 } | 309 } |
OLD | NEW |