| 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 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) | 17 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) |
| 17 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 18 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
| 18 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 19 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
| 19 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 20 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
| 20 | 21 |
| 21 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, | 22 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, |
| 22 CPDFSDK_PageView* pPageView, | 23 CPDFSDK_PageView* pPageView, |
| 23 CPDFSDK_InterForm* pInterForm) | 24 CPDFSDK_InterForm* pInterForm) |
| 24 : CPDFSDK_BAAnnot(pAnnot, pPageView), | 25 : CPDFSDK_BAAnnot(pAnnot, pPageView), |
| (...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1442 m_pInterForm = nullptr; | 1443 m_pInterForm = nullptr; |
| 1443 m_Map.clear(); | 1444 m_Map.clear(); |
| 1444 } | 1445 } |
| 1445 | 1446 |
| 1446 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { | 1447 FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { |
| 1447 return FALSE; | 1448 return FALSE; |
| 1448 } | 1449 } |
| 1449 | 1450 |
| 1450 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, | 1451 CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, |
| 1451 FX_BOOL bNext) const { | 1452 FX_BOOL bNext) const { |
| 1452 nonstd::unique_ptr<CBA_AnnotIterator> pIterator( | 1453 std::unique_ptr<CBA_AnnotIterator> pIterator( |
| 1453 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); | 1454 new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); |
| 1454 | 1455 |
| 1455 if (bNext) { | 1456 if (bNext) { |
| 1456 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); | 1457 return (CPDFSDK_Widget*)pIterator->GetNextAnnot(pWidget); |
| 1457 } | 1458 } |
| 1458 return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); | 1459 return (CPDFSDK_Widget*)pIterator->GetPrevAnnot(pWidget); |
| 1459 } | 1460 } |
| 1460 | 1461 |
| 1461 CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const { | 1462 CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const { |
| 1462 if (!pControl || !m_pInterForm) | 1463 if (!pControl || !m_pInterForm) |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 pBuf = FX_Alloc(uint8_t, nBufSize); | 1911 pBuf = FX_Alloc(uint8_t, nBufSize); |
| 1911 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); | 1912 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); |
| 1912 } | 1913 } |
| 1913 return TRUE; | 1914 return TRUE; |
| 1914 } | 1915 } |
| 1915 | 1916 |
| 1916 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( | 1917 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( |
| 1917 const std::vector<CPDF_FormField*>& fields, | 1918 const std::vector<CPDF_FormField*>& fields, |
| 1918 FX_BOOL bIncludeOrExclude, | 1919 FX_BOOL bIncludeOrExclude, |
| 1919 CFX_ByteTextBuf& textBuf) { | 1920 CFX_ByteTextBuf& textBuf) { |
| 1920 nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( | 1921 std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( |
| 1921 m_pDocument->GetPath(), fields, bIncludeOrExclude)); | 1922 m_pDocument->GetPath(), fields, bIncludeOrExclude)); |
| 1922 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; | 1923 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; |
| 1923 } | 1924 } |
| 1924 | 1925 |
| 1925 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( | 1926 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( |
| 1926 const CFX_WideString& sFileExt) { | 1927 const CFX_WideString& sFileExt) { |
| 1927 CFX_WideString sFileName; | 1928 CFX_WideString sFileName; |
| 1928 return L""; | 1929 return L""; |
| 1929 } | 1930 } |
| 1930 | 1931 |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2356 break; | 2357 break; |
| 2357 } | 2358 } |
| 2358 } | 2359 } |
| 2359 } | 2360 } |
| 2360 | 2361 |
| 2361 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 2362 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
| 2362 CPDF_Rect rcAnnot; | 2363 CPDF_Rect rcAnnot; |
| 2363 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2364 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
| 2364 return rcAnnot; | 2365 return rcAnnot; |
| 2365 } | 2366 } |
| OLD | NEW |