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 "../include/formfiller/FFL_FormFiller.h" | 7 #include "../include/formfiller/FFL_FormFiller.h" |
8 #include "../include/fsdk_actionhandler.h" | 8 #include "../include/fsdk_actionhandler.h" |
9 #include "../include/fsdk_baseannot.h" | 9 #include "../include/fsdk_baseannot.h" |
10 #include "../include/fsdk_baseform.h" | 10 #include "../include/fsdk_baseform.h" |
11 #include "../include/fsdk_define.h" | 11 #include "../include/fsdk_define.h" |
12 #include "../include/fsdk_mgr.h" | 12 #include "../include/fsdk_mgr.h" |
13 #include "third_party/base/nonstd_unique_ptr.h" | 13 #include "third_party/base/nonstd_unique_ptr.h" |
14 | 14 |
15 #include "../include/javascript/IJavaScript.h" | 15 #include "../include/javascript/IJavaScript.h" |
16 | 16 |
17 //------------------------------------------------------------------------------
------ | |
18 //* CPDFSDK_Widget | |
19 //------------------------------------------------------------------------------
------ | |
20 | |
21 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) | 17 #define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) |
22 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) | 18 #define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) |
23 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) | 19 #define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) |
24 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) | 20 #define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) |
25 | 21 |
26 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, | 22 CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, |
27 CPDFSDK_PageView* pPageView, | 23 CPDFSDK_PageView* pPageView, |
28 CPDFSDK_InterForm* pInterForm) | 24 CPDFSDK_InterForm* pInterForm) |
29 : CPDFSDK_BAAnnot(pAnnot, pPageView), | 25 : CPDFSDK_BAAnnot(pAnnot, pPageView), |
30 m_pInterForm(pInterForm), | 26 m_pInterForm(pInterForm), |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 pEdit->SetAlignmentV(1); | 949 pEdit->SetAlignmentV(1); |
954 | 950 |
955 FX_FLOAT fFontSize = GetFontSize(); | 951 FX_FLOAT fFontSize = GetFontSize(); |
956 if (IsFloatZero(fFontSize)) | 952 if (IsFloatZero(fFontSize)) |
957 pEdit->SetAutoFontSize(TRUE); | 953 pEdit->SetAutoFontSize(TRUE); |
958 else | 954 else |
959 pEdit->SetFontSize(fFontSize); | 955 pEdit->SetFontSize(fFontSize); |
960 | 956 |
961 pEdit->Initialize(); | 957 pEdit->Initialize(); |
962 | 958 |
963 if (sValue) | 959 if (sValue) { |
964 pEdit->SetText(sValue); | 960 pEdit->SetText(sValue); |
965 else { | 961 } else { |
966 int32_t nCurSel = pField->GetSelectedIndex(0); | 962 int32_t nCurSel = pField->GetSelectedIndex(0); |
967 | 963 |
968 if (nCurSel < 0) | 964 if (nCurSel < 0) |
969 pEdit->SetText(pField->GetValue().c_str()); | 965 pEdit->SetText(pField->GetValue().c_str()); |
970 else | 966 else |
971 pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str()); | 967 pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str()); |
972 } | 968 } |
973 | 969 |
974 CPDF_Rect rcContent = pEdit->GetContentRect(); | 970 CPDF_Rect rcContent = pEdit->GetContentRect(); |
975 | 971 |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 if (nPageIndex >= 0) { | 1578 if (nPageIndex >= 0) { |
1583 pPage = m_pDocument->GetPageView(nPageIndex); | 1579 pPage = m_pDocument->GetPageView(nPageIndex); |
1584 } | 1580 } |
1585 } | 1581 } |
1586 | 1582 |
1587 if (!pPage) | 1583 if (!pPage) |
1588 return nullptr; | 1584 return nullptr; |
1589 return (CPDFSDK_Widget*)pPage->GetAnnotByDict(pControlDict); | 1585 return (CPDFSDK_Widget*)pPage->GetAnnotByDict(pControlDict); |
1590 } | 1586 } |
1591 | 1587 |
1592 void CPDFSDK_InterForm::GetWidgets(const CFX_WideString& sFieldName, | 1588 void CPDFSDK_InterForm::GetWidgets( |
1593 CFX_PtrArray& widgets) { | 1589 const CFX_WideString& sFieldName, |
1594 ASSERT(m_pInterForm != NULL); | 1590 std::vector<CPDFSDK_Widget*>* widgets) const { |
1595 | 1591 for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; ++i) { |
1596 for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; i++) { | |
1597 CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); | 1592 CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); |
1598 ASSERT(pFormField != NULL); | 1593 ASSERT(pFormField); |
1599 | |
1600 GetWidgets(pFormField, widgets); | 1594 GetWidgets(pFormField, widgets); |
1601 } | 1595 } |
1602 } | 1596 } |
1603 | 1597 |
1604 void CPDFSDK_InterForm::GetWidgets(CPDF_FormField* pField, | 1598 void CPDFSDK_InterForm::GetWidgets( |
1605 CFX_PtrArray& widgets) { | 1599 CPDF_FormField* pField, |
1606 ASSERT(pField != NULL); | 1600 std::vector<CPDFSDK_Widget*>* widgets) const { |
1607 | 1601 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) { |
1608 for (int i = 0, isz = pField->CountControls(); i < isz; i++) { | |
1609 CPDF_FormControl* pFormCtrl = pField->GetControl(i); | 1602 CPDF_FormControl* pFormCtrl = pField->GetControl(i); |
1610 ASSERT(pFormCtrl != NULL); | 1603 ASSERT(pFormCtrl); |
1611 | |
1612 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); | 1604 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); |
1613 | |
1614 if (pWidget) | 1605 if (pWidget) |
1615 widgets.Add(pWidget); | 1606 widgets->push_back(pWidget); |
1616 } | 1607 } |
1617 } | 1608 } |
1618 | 1609 |
1619 int CPDFSDK_InterForm::GetPageIndexByAnnotDict( | 1610 int CPDFSDK_InterForm::GetPageIndexByAnnotDict( |
1620 CPDF_Document* pDocument, | 1611 CPDF_Document* pDocument, |
1621 CPDF_Dictionary* pAnnotDict) const { | 1612 CPDF_Dictionary* pAnnotDict) const { |
1622 ASSERT(pDocument != NULL); | 1613 ASSERT(pDocument != NULL); |
1623 ASSERT(pAnnotDict != NULL); | 1614 ASSERT(pAnnotDict != NULL); |
1624 | 1615 |
1625 for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { | 1616 for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 } | 1916 } |
1926 } | 1917 } |
1927 } | 1918 } |
1928 | 1919 |
1929 /* ----------------------------- action ----------------------------- */ | 1920 /* ----------------------------- action ----------------------------- */ |
1930 | 1921 |
1931 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { | 1922 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { |
1932 ASSERT(action); | 1923 ASSERT(action); |
1933 | 1924 |
1934 CPDF_ActionFields af = action.GetWidgets(); | 1925 CPDF_ActionFields af = action.GetWidgets(); |
1935 CFX_PtrArray fieldObjects; | 1926 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); |
1936 af.GetAllFields(fieldObjects); | 1927 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); |
1937 CFX_PtrArray widgetArray; | |
1938 CFX_PtrArray fields; | |
1939 GetFieldFromObjects(fieldObjects, fields); | |
1940 | 1928 |
1941 FX_BOOL bHide = action.GetHideStatus(); | 1929 FX_BOOL bHide = action.GetHideStatus(); |
1942 | |
1943 FX_BOOL bChanged = FALSE; | 1930 FX_BOOL bChanged = FALSE; |
1944 | 1931 |
1945 for (int i = 0, sz = fields.GetSize(); i < sz; i++) { | 1932 for (CPDF_FormField* pField : fields) { |
1946 CPDF_FormField* pField = (CPDF_FormField*)fields[i]; | 1933 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) { |
1947 ASSERT(pField != NULL); | 1934 CPDF_FormControl* pControl = pField->GetControl(i); |
1948 | 1935 ASSERT(pControl); |
1949 for (int j = 0, jsz = pField->CountControls(); j < jsz; j++) { | |
1950 CPDF_FormControl* pControl = pField->GetControl(j); | |
1951 ASSERT(pControl != NULL); | |
1952 | 1936 |
1953 if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) { | 1937 if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) { |
1954 int nFlags = pWidget->GetFlags(); | 1938 int nFlags = pWidget->GetFlags(); |
1955 if (bHide) { | 1939 nFlags &= ~ANNOTFLAG_INVISIBLE; |
1956 nFlags &= (~ANNOTFLAG_INVISIBLE); | 1940 nFlags &= ~ANNOTFLAG_NOVIEW; |
1957 nFlags &= (~ANNOTFLAG_NOVIEW); | 1941 if (bHide) |
1958 nFlags |= (ANNOTFLAG_HIDDEN); | 1942 nFlags |= ANNOTFLAG_HIDDEN; |
1959 } else { | 1943 else |
1960 nFlags &= (~ANNOTFLAG_INVISIBLE); | 1944 nFlags &= ~ANNOTFLAG_HIDDEN; |
1961 nFlags &= (~ANNOTFLAG_HIDDEN); | |
1962 nFlags &= (~ANNOTFLAG_NOVIEW); | |
1963 } | |
1964 pWidget->SetFlags(nFlags); | 1945 pWidget->SetFlags(nFlags); |
1965 | 1946 pWidget->GetPageView()->UpdateView(pWidget); |
1966 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | |
1967 ASSERT(pPageView != NULL); | |
1968 | |
1969 pPageView->UpdateView(pWidget); | |
1970 | |
1971 bChanged = TRUE; | 1947 bChanged = TRUE; |
1972 } | 1948 } |
1973 } | 1949 } |
1974 } | 1950 } |
1975 | 1951 |
1976 return bChanged; | 1952 return bChanged; |
1977 } | 1953 } |
1978 | 1954 |
1979 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { | 1955 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { |
1980 ASSERT(m_pInterForm != NULL); | 1956 ASSERT(m_pInterForm != NULL); |
1981 CFX_WideString sDestination = action.GetFilePath(); | 1957 CFX_WideString sDestination = action.GetFilePath(); |
1982 if (sDestination.IsEmpty()) | 1958 if (sDestination.IsEmpty()) |
1983 return FALSE; | 1959 return FALSE; |
1984 | 1960 |
1985 CPDF_Dictionary* pActionDict = action.GetDict(); | 1961 CPDF_Dictionary* pActionDict = action.GetDict(); |
1986 if (pActionDict->KeyExist("Fields")) { | 1962 if (pActionDict->KeyExist("Fields")) { |
1987 CPDF_ActionFields af = action.GetWidgets(); | 1963 CPDF_ActionFields af = action.GetWidgets(); |
1988 FX_DWORD dwFlags = action.GetFlags(); | 1964 FX_DWORD dwFlags = action.GetFlags(); |
1989 CFX_PtrArray fieldObjects; | 1965 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); |
1990 af.GetAllFields(fieldObjects); | 1966 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); |
1991 | 1967 if (!fields.empty()) { |
1992 CFX_PtrArray fields; | 1968 bool bIncludeOrExclude = !(dwFlags & 0x01); |
1993 GetFieldFromObjects(fieldObjects, fields); | |
1994 if (fields.GetSize() != 0) { | |
1995 FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); | |
1996 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) | 1969 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) |
1997 return FALSE; | 1970 return FALSE; |
1998 | 1971 |
1999 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE); | 1972 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE); |
2000 } | 1973 } |
2001 } | 1974 } |
2002 if (m_pInterForm->CheckRequiredFields()) | 1975 if (m_pInterForm->CheckRequiredFields(nullptr, true)) |
2003 return FALSE; | 1976 return FALSE; |
2004 | 1977 |
2005 return SubmitForm(sDestination, FALSE); | 1978 return SubmitForm(sDestination, FALSE); |
2006 } | 1979 } |
2007 | 1980 |
2008 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, | 1981 FX_BOOL CPDFSDK_InterForm::SubmitFields( |
2009 const CFX_PtrArray& fields, | 1982 const CFX_WideString& csDestination, |
2010 FX_BOOL bIncludeOrExclude, | 1983 const std::vector<CPDF_FormField*>& fields, |
2011 FX_BOOL bUrlEncoded) { | 1984 FX_BOOL bIncludeOrExclude, |
| 1985 FX_BOOL bUrlEncoded) { |
2012 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 1986 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
2013 ASSERT(pEnv != NULL); | |
2014 | 1987 |
2015 CFX_ByteTextBuf textBuf; | 1988 CFX_ByteTextBuf textBuf; |
2016 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); | 1989 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); |
2017 | 1990 |
2018 uint8_t* pBuffer = textBuf.GetBuffer(); | 1991 uint8_t* pBuffer = textBuf.GetBuffer(); |
2019 FX_STRSIZE nBufSize = textBuf.GetLength(); | 1992 FX_STRSIZE nBufSize = textBuf.GetLength(); |
2020 | 1993 |
2021 if (bUrlEncoded) { | 1994 if (bUrlEncoded && !FDFToURLEncodedData(pBuffer, nBufSize)) |
2022 if (!FDFToURLEncodedData(pBuffer, nBufSize)) | 1995 return FALSE; |
2023 return FALSE; | |
2024 } | |
2025 | 1996 |
2026 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); | 1997 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); |
2027 | |
2028 return TRUE; | 1998 return TRUE; |
2029 } | 1999 } |
2030 | 2000 |
2031 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, | 2001 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, |
2032 CFX_WideString csTxtFile) { | 2002 CFX_WideString csTxtFile) { |
2033 return TRUE; | 2003 return TRUE; |
2034 } | 2004 } |
2035 | 2005 |
2036 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, | 2006 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, |
2037 FX_STRSIZE& nBufSize) { | 2007 FX_STRSIZE& nBufSize) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 fdfEncodedData = fdfEncodedData << "&"; | 2039 fdfEncodedData = fdfEncodedData << "&"; |
2070 } | 2040 } |
2071 | 2041 |
2072 nBufSize = fdfEncodedData.GetLength(); | 2042 nBufSize = fdfEncodedData.GetLength(); |
2073 pBuf = FX_Alloc(uint8_t, nBufSize); | 2043 pBuf = FX_Alloc(uint8_t, nBufSize); |
2074 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); | 2044 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); |
2075 } | 2045 } |
2076 return TRUE; | 2046 return TRUE; |
2077 } | 2047 } |
2078 | 2048 |
2079 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields, | 2049 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( |
2080 FX_BOOL bIncludeOrExclude, | 2050 const std::vector<CPDF_FormField*>& fields, |
2081 CFX_ByteTextBuf& textBuf) { | 2051 FX_BOOL bIncludeOrExclude, |
2082 ASSERT(m_pDocument != NULL); | 2052 CFX_ByteTextBuf& textBuf) { |
2083 ASSERT(m_pInterForm != NULL); | 2053 nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( |
2084 | 2054 m_pDocument->GetPath(), fields, bIncludeOrExclude)); |
2085 CFDF_Document* pFDF = m_pInterForm->ExportToFDF( | 2055 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; |
2086 m_pDocument->GetPath(), (CFX_PtrArray&)fields, bIncludeOrExclude); | |
2087 if (!pFDF) | |
2088 return FALSE; | |
2089 FX_BOOL bRet = pFDF->WriteBuf(textBuf); | |
2090 delete pFDF; | |
2091 | |
2092 return bRet; | |
2093 } | 2056 } |
2094 | 2057 |
2095 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( | 2058 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( |
2096 const CFX_WideString& sFileExt) { | 2059 const CFX_WideString& sFileExt) { |
2097 CFX_WideString sFileName; | 2060 CFX_WideString sFileName; |
2098 return L""; | 2061 return L""; |
2099 } | 2062 } |
2100 | 2063 |
2101 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, | 2064 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, |
2102 FX_BOOL bUrlEncoded) { | 2065 FX_BOOL bUrlEncoded) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2151 FX_BOOL bRet = pFDF->WriteBuf(textBuf); | 2114 FX_BOOL bRet = pFDF->WriteBuf(textBuf); |
2152 delete pFDF; | 2115 delete pFDF; |
2153 | 2116 |
2154 return bRet; | 2117 return bRet; |
2155 } | 2118 } |
2156 | 2119 |
2157 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { | 2120 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { |
2158 ASSERT(action); | 2121 ASSERT(action); |
2159 | 2122 |
2160 CPDF_Dictionary* pActionDict = action.GetDict(); | 2123 CPDF_Dictionary* pActionDict = action.GetDict(); |
2161 if (pActionDict->KeyExist("Fields")) { | 2124 if (!pActionDict->KeyExist("Fields")) |
2162 CPDF_ActionFields af = action.GetWidgets(); | 2125 return m_pInterForm->ResetForm(true); |
2163 FX_DWORD dwFlags = action.GetFlags(); | |
2164 | 2126 |
2165 CFX_PtrArray fieldObjects; | 2127 CPDF_ActionFields af = action.GetWidgets(); |
2166 af.GetAllFields(fieldObjects); | 2128 FX_DWORD dwFlags = action.GetFlags(); |
2167 CFX_PtrArray fields; | |
2168 GetFieldFromObjects(fieldObjects, fields); | |
2169 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); | |
2170 } | |
2171 | 2129 |
2172 return m_pInterForm->ResetForm(TRUE); | 2130 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); |
| 2131 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); |
| 2132 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true); |
2173 } | 2133 } |
2174 | 2134 |
2175 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { | 2135 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { |
2176 return FALSE; | 2136 return FALSE; |
2177 } | 2137 } |
2178 | 2138 |
2179 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, | 2139 std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( |
2180 CFX_PtrArray& fields) { | 2140 const std::vector<CPDF_Object*>& objects) const { |
2181 ASSERT(m_pInterForm != NULL); | 2141 std::vector<CPDF_FormField*> fields; |
2182 | 2142 for (CPDF_Object* pObject : objects) { |
2183 int iCount = objects.GetSize(); | 2143 if (pObject && pObject->IsString()) { |
2184 for (int i = 0; i < iCount; i++) { | |
2185 CPDF_Object* pObject = static_cast<CPDF_Object*>(objects[i]); | |
2186 if (!pObject) | |
2187 continue; | |
2188 | |
2189 if (pObject->IsString()) { | |
2190 CFX_WideString csName = pObject->GetUnicodeText(); | 2144 CFX_WideString csName = pObject->GetUnicodeText(); |
2191 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); | 2145 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); |
2192 if (pField) | 2146 if (pField) |
2193 fields.Add(pField); | 2147 fields.push_back(pField); |
2194 } else if (pObject->IsDictionary()) { | |
2195 if (m_pInterForm->IsValidFormField(pObject)) | |
2196 fields.Add(pObject); | |
2197 } | 2148 } |
2198 } | 2149 } |
| 2150 return fields; |
2199 } | 2151 } |
2200 | 2152 |
2201 /* ----------------------------- CPDF_FormNotify ----------------------------- | 2153 /* ----------------------------- CPDF_FormNotify ----------------------------- |
2202 */ | 2154 */ |
2203 | 2155 |
2204 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, | 2156 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, |
2205 CFX_WideString& csValue) { | 2157 CFX_WideString& csValue) { |
2206 CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 2158 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
2207 int nType = pFormField->GetFieldType(); | 2159 int nType = pFormField->GetFieldType(); |
2208 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { | 2160 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 break; | 2502 break; |
2551 } | 2503 } |
2552 } | 2504 } |
2553 } | 2505 } |
2554 | 2506 |
2555 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 2507 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
2556 CPDF_Rect rcAnnot; | 2508 CPDF_Rect rcAnnot; |
2557 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2509 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
2558 return rcAnnot; | 2510 return rcAnnot; |
2559 } | 2511 } |
OLD | NEW |