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 <memory> |
| 8 |
7 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
8 #include "fpdfsdk/include/fsdk_actionhandler.h" | 10 #include "fpdfsdk/include/fsdk_actionhandler.h" |
9 #include "fpdfsdk/include/fsdk_baseannot.h" | 11 #include "fpdfsdk/include/fsdk_baseannot.h" |
10 #include "fpdfsdk/include/fsdk_baseform.h" | 12 #include "fpdfsdk/include/fsdk_baseform.h" |
11 #include "fpdfsdk/include/fsdk_define.h" | 13 #include "fpdfsdk/include/fsdk_define.h" |
12 #include "fpdfsdk/include/fsdk_mgr.h" | 14 #include "fpdfsdk/include/fsdk_mgr.h" |
13 #include "fpdfsdk/include/javascript/IJavaScript.h" | 15 #include "fpdfsdk/include/javascript/IJavaScript.h" |
14 #include "third_party/base/nonstd_unique_ptr.h" | |
15 | 16 |
16 #ifdef PDF_ENABLE_XFA | 17 #ifdef PDF_ENABLE_XFA |
17 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 18 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
18 #include "../include/fpdfxfa/fpdfxfa_util.h" | 19 #include "../include/fpdfxfa/fpdfxfa_util.h" |
19 #endif // PDF_ENABLE_XFA | 20 #endif // PDF_ENABLE_XFA |
20 | 21 |
21 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) | 22 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) |
22 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 23 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
23 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 24 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
24 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 25 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
(...skipping 2023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2048 m_XFAMap.RemoveAll(); | 2049 m_XFAMap.RemoveAll(); |
2049 #endif // PDF_ENABLE_XFA | 2050 #endif // PDF_ENABLE_XFA |
2050 } | 2051 } |
2051 | 2052 |
2052 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { | 2053 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { |
2053 return FALSE; | 2054 return FALSE; |
2054 } | 2055 } |
2055 | 2056 |
2056 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, | 2057 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, |
2057 FX_BOOL bNext) const { | 2058 FX_BOOL bNext) const { |
2058 nonstd::unique_ptr<CBA_AnnotIterator> pIterator( | 2059 std::unique_ptr<CBA_AnnotIterator> pIterator( |
2059 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); | 2060 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); |
2060 | 2061 |
2061 if (bNext) { | 2062 if (bNext) { |
2062 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); | 2063 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); |
2063 } | 2064 } |
2064 return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); | 2065 return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); |
2065 } | 2066 } |
2066 | 2067 |
2067 CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const { | 2068 CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const { |
2068 if (!pControl || !m_pInterForm) | 2069 if (!pControl || !m_pInterForm) |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 pBuf = FX_Alloc(uint8_t, nBufSize); | 2549 pBuf = FX_Alloc(uint8_t, nBufSize); |
2549 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); | 2550 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); |
2550 } | 2551 } |
2551 return TRUE; | 2552 return TRUE; |
2552 } | 2553 } |
2553 | 2554 |
2554 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( | 2555 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( |
2555 const std::vector<CPDF_FormField*>& fields, | 2556 const std::vector<CPDF_FormField*>& fields, |
2556 FX_BOOL bIncludeOrExclude, | 2557 FX_BOOL bIncludeOrExclude, |
2557 CFX_ByteTextBuf& textBuf) { | 2558 CFX_ByteTextBuf& textBuf) { |
2558 nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( | 2559 std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( |
2559 m_pDocument->GetPath(), fields, bIncludeOrExclude)); | 2560 m_pDocument->GetPath(), fields, bIncludeOrExclude)); |
2560 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; | 2561 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; |
2561 } | 2562 } |
2562 | 2563 |
2563 #ifdef PDF_ENABLE_XFA | 2564 #ifdef PDF_ENABLE_XFA |
2564 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, | 2565 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, |
2565 FX_BOOL bSynchronizeElse) { | 2566 FX_BOOL bSynchronizeElse) { |
2566 ASSERT(pFormField != NULL); | 2567 ASSERT(pFormField != NULL); |
2567 | 2568 |
2568 int x = 0; | 2569 int x = 0; |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3018 break; | 3019 break; |
3019 } | 3020 } |
3020 } | 3021 } |
3021 } | 3022 } |
3022 | 3023 |
3023 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 3024 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
3024 CPDF_Rect rcAnnot; | 3025 CPDF_Rect rcAnnot; |
3025 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 3026 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
3026 return rcAnnot; | 3027 return rcAnnot; |
3027 } | 3028 } |
OLD | NEW |