Chromium Code Reviews| 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" |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 953 pEdit->SetAlignmentV(1); | 953 pEdit->SetAlignmentV(1); |
| 954 | 954 |
| 955 FX_FLOAT fFontSize = GetFontSize(); | 955 FX_FLOAT fFontSize = GetFontSize(); |
| 956 if (IsFloatZero(fFontSize)) | 956 if (IsFloatZero(fFontSize)) |
| 957 pEdit->SetAutoFontSize(TRUE); | 957 pEdit->SetAutoFontSize(TRUE); |
| 958 else | 958 else |
| 959 pEdit->SetFontSize(fFontSize); | 959 pEdit->SetFontSize(fFontSize); |
| 960 | 960 |
| 961 pEdit->Initialize(); | 961 pEdit->Initialize(); |
| 962 | 962 |
| 963 if (sValue) | 963 if (sValue) { |
| 964 pEdit->SetText(sValue); | 964 pEdit->SetText(sValue); |
| 965 else { | 965 } else { |
| 966 int32_t nCurSel = pField->GetSelectedIndex(0); | 966 int32_t nCurSel = pField->GetSelectedIndex(0); |
| 967 | 967 |
| 968 if (nCurSel < 0) | 968 if (nCurSel < 0) |
| 969 pEdit->SetText(pField->GetValue().c_str()); | 969 pEdit->SetText(pField->GetValue().c_str()); |
| 970 else | 970 else |
| 971 pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str()); | 971 pEdit->SetText(pField->GetOptionLabel(nCurSel).c_str()); |
| 972 } | 972 } |
| 973 | 973 |
| 974 CPDF_Rect rcContent = pEdit->GetContentRect(); | 974 CPDF_Rect rcContent = pEdit->GetContentRect(); |
| 975 | 975 |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1582 if (nPageIndex >= 0) { | 1582 if (nPageIndex >= 0) { |
| 1583 pPage = m_pDocument->GetPageView(nPageIndex); | 1583 pPage = m_pDocument->GetPageView(nPageIndex); |
| 1584 } | 1584 } |
| 1585 } | 1585 } |
| 1586 | 1586 |
| 1587 if (!pPage) | 1587 if (!pPage) |
| 1588 return nullptr; | 1588 return nullptr; |
| 1589 return (CPDFSDK_Widget*)pPage->GetAnnotByDict(pControlDict); | 1589 return (CPDFSDK_Widget*)pPage->GetAnnotByDict(pControlDict); |
| 1590 } | 1590 } |
| 1591 | 1591 |
| 1592 void CPDFSDK_InterForm::GetWidgets(const CFX_WideString& sFieldName, | 1592 void CPDFSDK_InterForm::GetWidgets( |
| 1593 CFX_PtrArray& widgets) { | 1593 const CFX_WideString& sFieldName, |
| 1594 ASSERT(m_pInterForm != NULL); | 1594 std::vector<CPDFSDK_Widget*>* widgets) const { |
| 1595 | 1595 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); | 1596 CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); |
| 1598 ASSERT(pFormField != NULL); | 1597 ASSERT(pFormField); |
| 1599 | |
| 1600 GetWidgets(pFormField, widgets); | 1598 GetWidgets(pFormField, widgets); |
| 1601 } | 1599 } |
| 1602 } | 1600 } |
| 1603 | 1601 |
| 1604 void CPDFSDK_InterForm::GetWidgets(CPDF_FormField* pField, | 1602 void CPDFSDK_InterForm::GetWidgets( |
| 1605 CFX_PtrArray& widgets) { | 1603 CPDF_FormField* pField, |
| 1606 ASSERT(pField != NULL); | 1604 std::vector<CPDFSDK_Widget*>* widgets) const { |
|
Tom Sepez
2015/11/09 21:25:32
I guess we don't want to first clear |widgets| her
Lei Zhang
2015/11/09 22:45:28
No, I think some caller are appending to |widgets|
| |
| 1607 | 1605 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); | 1606 CPDF_FormControl* pFormCtrl = pField->GetControl(i); |
| 1610 ASSERT(pFormCtrl != NULL); | 1607 ASSERT(pFormCtrl); |
| 1611 | |
| 1612 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); | 1608 CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl); |
| 1613 | |
| 1614 if (pWidget) | 1609 if (pWidget) |
| 1615 widgets.Add(pWidget); | 1610 widgets->push_back(pWidget); |
| 1616 } | 1611 } |
| 1617 } | 1612 } |
| 1618 | 1613 |
| 1619 int CPDFSDK_InterForm::GetPageIndexByAnnotDict( | 1614 int CPDFSDK_InterForm::GetPageIndexByAnnotDict( |
| 1620 CPDF_Document* pDocument, | 1615 CPDF_Document* pDocument, |
| 1621 CPDF_Dictionary* pAnnotDict) const { | 1616 CPDF_Dictionary* pAnnotDict) const { |
| 1622 ASSERT(pDocument != NULL); | 1617 ASSERT(pDocument != NULL); |
| 1623 ASSERT(pAnnotDict != NULL); | 1618 ASSERT(pAnnotDict != NULL); |
| 1624 | 1619 |
| 1625 for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { | 1620 for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1925 } | 1920 } |
| 1926 } | 1921 } |
| 1927 } | 1922 } |
| 1928 | 1923 |
| 1929 /* ----------------------------- action ----------------------------- */ | 1924 /* ----------------------------- action ----------------------------- */ |
| 1930 | 1925 |
| 1931 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { | 1926 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { |
| 1932 ASSERT(action); | 1927 ASSERT(action); |
| 1933 | 1928 |
| 1934 CPDF_ActionFields af = action.GetWidgets(); | 1929 CPDF_ActionFields af = action.GetWidgets(); |
| 1935 CFX_PtrArray fieldObjects; | 1930 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); |
| 1936 af.GetAllFields(fieldObjects); | 1931 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); |
| 1937 CFX_PtrArray widgetArray; | |
| 1938 CFX_PtrArray fields; | |
| 1939 GetFieldFromObjects(fieldObjects, fields); | |
| 1940 | 1932 |
| 1941 FX_BOOL bHide = action.GetHideStatus(); | 1933 FX_BOOL bHide = action.GetHideStatus(); |
| 1942 | |
| 1943 FX_BOOL bChanged = FALSE; | 1934 FX_BOOL bChanged = FALSE; |
| 1944 | 1935 |
| 1945 for (int i = 0, sz = fields.GetSize(); i < sz; i++) { | 1936 for (CPDF_FormField* pField : fields) { |
| 1946 CPDF_FormField* pField = (CPDF_FormField*)fields[i]; | 1937 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) { |
| 1947 ASSERT(pField != NULL); | 1938 CPDF_FormControl* pControl = pField->GetControl(i); |
| 1948 | |
| 1949 for (int j = 0, jsz = pField->CountControls(); j < jsz; j++) { | |
| 1950 CPDF_FormControl* pControl = pField->GetControl(j); | |
| 1951 ASSERT(pControl != NULL); | 1939 ASSERT(pControl != NULL); |
|
Tom Sepez
2015/11/09 21:25:31
nit: just ASSERT(pControl)
Lei Zhang
2015/11/09 22:45:28
Done.
| |
| 1952 | 1940 |
| 1953 if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) { | 1941 if (CPDFSDK_Widget* pWidget = GetWidget(pControl)) { |
| 1954 int nFlags = pWidget->GetFlags(); | 1942 int nFlags = pWidget->GetFlags(); |
| 1955 if (bHide) { | 1943 if (bHide) { |
| 1956 nFlags &= (~ANNOTFLAG_INVISIBLE); | 1944 nFlags &= (~ANNOTFLAG_INVISIBLE); |
|
Tom Sepez
2015/11/09 21:25:32
nit: overparenthesization.
Lei Zhang
2015/11/09 22:45:28
Done.
| |
| 1957 nFlags &= (~ANNOTFLAG_NOVIEW); | 1945 nFlags &= (~ANNOTFLAG_NOVIEW); |
| 1958 nFlags |= (ANNOTFLAG_HIDDEN); | 1946 nFlags |= (ANNOTFLAG_HIDDEN); |
| 1959 } else { | 1947 } else { |
| 1960 nFlags &= (~ANNOTFLAG_INVISIBLE); | 1948 nFlags &= (~ANNOTFLAG_INVISIBLE); |
| 1961 nFlags &= (~ANNOTFLAG_HIDDEN); | 1949 nFlags &= (~ANNOTFLAG_HIDDEN); |
|
Tom Sepez
2015/11/09 21:25:32
nit: two of these occur in both branches.
Lei Zhang
2015/11/09 22:45:28
Done.
| |
| 1962 nFlags &= (~ANNOTFLAG_NOVIEW); | 1950 nFlags &= (~ANNOTFLAG_NOVIEW); |
| 1963 } | 1951 } |
| 1964 pWidget->SetFlags(nFlags); | 1952 pWidget->SetFlags(nFlags); |
| 1965 | 1953 |
| 1966 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 1954 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
| 1967 ASSERT(pPageView != NULL); | 1955 ASSERT(pPageView != NULL); |
|
Tom Sepez
2015/11/09 21:25:31
nit: not needed, segv on 1957.
Lei Zhang
2015/11/09 22:45:28
Done.
| |
| 1968 | 1956 |
| 1969 pPageView->UpdateView(pWidget); | 1957 pPageView->UpdateView(pWidget); |
| 1970 | 1958 |
| 1971 bChanged = TRUE; | 1959 bChanged = TRUE; |
| 1972 } | 1960 } |
| 1973 } | 1961 } |
| 1974 } | 1962 } |
| 1975 | 1963 |
| 1976 return bChanged; | 1964 return bChanged; |
| 1977 } | 1965 } |
| 1978 | 1966 |
| 1979 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { | 1967 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { |
| 1980 ASSERT(m_pInterForm != NULL); | 1968 ASSERT(m_pInterForm != NULL); |
| 1981 CFX_WideString sDestination = action.GetFilePath(); | 1969 CFX_WideString sDestination = action.GetFilePath(); |
| 1982 if (sDestination.IsEmpty()) | 1970 if (sDestination.IsEmpty()) |
| 1983 return FALSE; | 1971 return FALSE; |
| 1984 | 1972 |
| 1985 CPDF_Dictionary* pActionDict = action.GetDict(); | 1973 CPDF_Dictionary* pActionDict = action.GetDict(); |
| 1986 if (pActionDict->KeyExist("Fields")) { | 1974 if (pActionDict->KeyExist("Fields")) { |
| 1987 CPDF_ActionFields af = action.GetWidgets(); | 1975 CPDF_ActionFields af = action.GetWidgets(); |
| 1988 FX_DWORD dwFlags = action.GetFlags(); | 1976 FX_DWORD dwFlags = action.GetFlags(); |
| 1989 CFX_PtrArray fieldObjects; | 1977 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); |
| 1990 af.GetAllFields(fieldObjects); | 1978 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); |
| 1991 | 1979 if (!fields.empty()) { |
| 1992 CFX_PtrArray fields; | |
| 1993 GetFieldFromObjects(fieldObjects, fields); | |
| 1994 if (fields.GetSize() != 0) { | |
| 1995 FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); | 1980 FX_BOOL bIncludeOrExclude = !(dwFlags & 0x01); |
| 1996 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) | 1981 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) |
| 1997 return FALSE; | 1982 return FALSE; |
| 1998 | 1983 |
| 1999 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE); | 1984 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE); |
| 2000 } | 1985 } |
| 2001 } | 1986 } |
| 2002 if (m_pInterForm->CheckRequiredFields()) | 1987 if (m_pInterForm->CheckRequiredFields(nullptr, TRUE)) |
| 2003 return FALSE; | 1988 return FALSE; |
| 2004 | 1989 |
| 2005 return SubmitForm(sDestination, FALSE); | 1990 return SubmitForm(sDestination, FALSE); |
| 2006 } | 1991 } |
| 2007 | 1992 |
| 2008 FX_BOOL CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, | 1993 FX_BOOL CPDFSDK_InterForm::SubmitFields( |
| 2009 const CFX_PtrArray& fields, | 1994 const CFX_WideString& csDestination, |
| 2010 FX_BOOL bIncludeOrExclude, | 1995 const std::vector<CPDF_FormField*>& fields, |
| 2011 FX_BOOL bUrlEncoded) { | 1996 FX_BOOL bIncludeOrExclude, |
| 1997 FX_BOOL bUrlEncoded) { | |
| 2012 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 1998 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
|
Tom Sepez
2015/11/09 21:25:31
nit: move to 2012, lose assert.
Lei Zhang
2015/11/09 22:45:28
Done.
| |
| 2013 ASSERT(pEnv != NULL); | 1999 ASSERT(pEnv != NULL); |
| 2014 | 2000 |
| 2015 CFX_ByteTextBuf textBuf; | 2001 CFX_ByteTextBuf textBuf; |
| 2016 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); | 2002 ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude, textBuf); |
| 2017 | 2003 |
| 2018 uint8_t* pBuffer = textBuf.GetBuffer(); | 2004 uint8_t* pBuffer = textBuf.GetBuffer(); |
| 2019 FX_STRSIZE nBufSize = textBuf.GetLength(); | 2005 FX_STRSIZE nBufSize = textBuf.GetLength(); |
| 2020 | 2006 |
| 2021 if (bUrlEncoded) { | 2007 if (bUrlEncoded) { |
|
Tom Sepez
2015/11/09 21:25:32
nit: combine.
Lei Zhang
2015/11/09 22:45:28
Done.
| |
| 2022 if (!FDFToURLEncodedData(pBuffer, nBufSize)) | 2008 if (!FDFToURLEncodedData(pBuffer, nBufSize)) |
| 2023 return FALSE; | 2009 return FALSE; |
| 2024 } | 2010 } |
| 2025 | 2011 |
| 2026 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); | 2012 pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str()); |
| 2027 | 2013 |
| 2028 return TRUE; | 2014 return TRUE; |
| 2029 } | 2015 } |
| 2030 | 2016 |
| 2031 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, | 2017 FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(CFX_WideString csFDFFile, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2069 fdfEncodedData = fdfEncodedData << "&"; | 2055 fdfEncodedData = fdfEncodedData << "&"; |
| 2070 } | 2056 } |
| 2071 | 2057 |
| 2072 nBufSize = fdfEncodedData.GetLength(); | 2058 nBufSize = fdfEncodedData.GetLength(); |
| 2073 pBuf = FX_Alloc(uint8_t, nBufSize); | 2059 pBuf = FX_Alloc(uint8_t, nBufSize); |
| 2074 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); | 2060 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); |
| 2075 } | 2061 } |
| 2076 return TRUE; | 2062 return TRUE; |
| 2077 } | 2063 } |
| 2078 | 2064 |
| 2079 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields, | 2065 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( |
| 2080 FX_BOOL bIncludeOrExclude, | 2066 const std::vector<CPDF_FormField*>& fields, |
| 2081 CFX_ByteTextBuf& textBuf) { | 2067 FX_BOOL bIncludeOrExclude, |
| 2082 ASSERT(m_pDocument != NULL); | 2068 CFX_ByteTextBuf& textBuf) { |
| 2083 ASSERT(m_pInterForm != NULL); | 2069 nonstd::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( |
| 2084 | 2070 m_pDocument->GetPath(), fields, bIncludeOrExclude)); |
| 2085 CFDF_Document* pFDF = m_pInterForm->ExportToFDF( | 2071 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 } | 2072 } |
| 2094 | 2073 |
| 2095 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( | 2074 CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( |
| 2096 const CFX_WideString& sFileExt) { | 2075 const CFX_WideString& sFileExt) { |
| 2097 CFX_WideString sFileName; | 2076 CFX_WideString sFileName; |
| 2098 return L""; | 2077 return L""; |
| 2099 } | 2078 } |
| 2100 | 2079 |
| 2101 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, | 2080 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, |
| 2102 FX_BOOL bUrlEncoded) { | 2081 FX_BOOL bUrlEncoded) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2151 FX_BOOL bRet = pFDF->WriteBuf(textBuf); | 2130 FX_BOOL bRet = pFDF->WriteBuf(textBuf); |
| 2152 delete pFDF; | 2131 delete pFDF; |
| 2153 | 2132 |
| 2154 return bRet; | 2133 return bRet; |
| 2155 } | 2134 } |
| 2156 | 2135 |
| 2157 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { | 2136 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { |
| 2158 ASSERT(action); | 2137 ASSERT(action); |
| 2159 | 2138 |
| 2160 CPDF_Dictionary* pActionDict = action.GetDict(); | 2139 CPDF_Dictionary* pActionDict = action.GetDict(); |
| 2161 if (pActionDict->KeyExist("Fields")) { | 2140 if (!pActionDict->KeyExist("Fields")) |
| 2162 CPDF_ActionFields af = action.GetWidgets(); | 2141 return m_pInterForm->ResetForm(true); |
| 2163 FX_DWORD dwFlags = action.GetFlags(); | |
| 2164 | 2142 |
| 2165 CFX_PtrArray fieldObjects; | 2143 CPDF_ActionFields af = action.GetWidgets(); |
| 2166 af.GetAllFields(fieldObjects); | 2144 FX_DWORD dwFlags = action.GetFlags(); |
| 2167 CFX_PtrArray fields; | |
| 2168 GetFieldFromObjects(fieldObjects, fields); | |
| 2169 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); | |
| 2170 } | |
| 2171 | 2145 |
| 2172 return m_pInterForm->ResetForm(TRUE); | 2146 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); |
| 2147 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); | |
| 2148 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true); | |
|
Tom Sepez
2015/11/09 21:25:32
nit: magic numbers again for dwFlags.
Lei Zhang
2015/11/09 22:45:28
Acknowledged.
| |
| 2173 } | 2149 } |
| 2174 | 2150 |
| 2175 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { | 2151 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { |
| 2176 return FALSE; | 2152 return FALSE; |
| 2177 } | 2153 } |
| 2178 | 2154 |
| 2179 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, | 2155 std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( |
| 2180 CFX_PtrArray& fields) { | 2156 const std::vector<CPDF_Object*>& objects) const { |
| 2181 ASSERT(m_pInterForm != NULL); | 2157 std::vector<CPDF_FormField*> fields; |
| 2182 | 2158 for (CPDF_Object* pObject : objects) { |
| 2183 int iCount = objects.GetSize(); | 2159 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(); | 2160 CFX_WideString csName = pObject->GetUnicodeText(); |
| 2191 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); | 2161 CPDF_FormField* pField = m_pInterForm->GetField(0, csName); |
| 2192 if (pField) | 2162 if (pField) |
| 2193 fields.Add(pField); | 2163 fields.push_back(pField); |
| 2194 } else if (pObject->IsDictionary()) { | |
| 2195 if (m_pInterForm->IsValidFormField(pObject)) | |
| 2196 fields.Add(pObject); | |
| 2197 } | 2164 } |
| 2198 } | 2165 } |
| 2166 return fields; | |
| 2199 } | 2167 } |
| 2200 | 2168 |
| 2201 /* ----------------------------- CPDF_FormNotify ----------------------------- | 2169 /* ----------------------------- CPDF_FormNotify ----------------------------- |
| 2202 */ | 2170 */ |
| 2203 | 2171 |
| 2204 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, | 2172 int CPDFSDK_InterForm::BeforeValueChange(const CPDF_FormField* pField, |
| 2205 CFX_WideString& csValue) { | 2173 CFX_WideString& csValue) { |
| 2206 CPDF_FormField* pFormField = (CPDF_FormField*)pField; | 2174 CPDF_FormField* pFormField = (CPDF_FormField*)pField; |
| 2207 int nType = pFormField->GetFieldType(); | 2175 int nType = pFormField->GetFieldType(); |
| 2208 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { | 2176 if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2550 break; | 2518 break; |
| 2551 } | 2519 } |
| 2552 } | 2520 } |
| 2553 } | 2521 } |
| 2554 | 2522 |
| 2555 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 2523 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
| 2556 CPDF_Rect rcAnnot; | 2524 CPDF_Rect rcAnnot; |
| 2557 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2525 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
| 2558 return rcAnnot; | 2526 return rcAnnot; |
| 2559 } | 2527 } |
| OLD | NEW |