| 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 "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 7 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
| 8 #include "fpdfsdk/include/fsdk_actionhandler.h" | 8 #include "fpdfsdk/include/fsdk_actionhandler.h" |
| 9 #include "fpdfsdk/include/fsdk_baseannot.h" | 9 #include "fpdfsdk/include/fsdk_baseannot.h" |
| 10 #include "fpdfsdk/include/fsdk_baseform.h" | 10 #include "fpdfsdk/include/fsdk_baseform.h" |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument) | 1512 CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_Document* pDocument) |
| 1513 : m_pDocument(pDocument), | 1513 : m_pDocument(pDocument), |
| 1514 m_pInterForm(NULL), | 1514 m_pInterForm(NULL), |
| 1515 m_bCalculate(TRUE), | 1515 m_bCalculate(TRUE), |
| 1516 m_bBusy(FALSE) { | 1516 m_bBusy(FALSE) { |
| 1517 ASSERT(m_pDocument != NULL); | 1517 ASSERT(m_pDocument != NULL); |
| 1518 m_pInterForm = new CPDF_InterForm(m_pDocument->GetDocument(), FALSE); | 1518 m_pInterForm = new CPDF_InterForm(m_pDocument->GetDocument(), FALSE); |
| 1519 ASSERT(m_pInterForm != NULL); | 1519 ASSERT(m_pInterForm != NULL); |
| 1520 m_pInterForm->SetFormNotify(this); | 1520 m_pInterForm->SetFormNotify(this); |
| 1521 | 1521 |
| 1522 for (int i = 0; i < 6; i++) | 1522 for (int i = 0; i < kNumFieldTypes; ++i) |
| 1523 m_bNeedHightlight[i] = FALSE; | 1523 m_bNeedHightlight[i] = FALSE; |
| 1524 m_iHighlightAlpha = 0; | 1524 m_iHighlightAlpha = 0; |
| 1525 } | 1525 } |
| 1526 | 1526 |
| 1527 CPDFSDK_InterForm::~CPDFSDK_InterForm() { | 1527 CPDFSDK_InterForm::~CPDFSDK_InterForm() { |
| 1528 delete m_pInterForm; | 1528 delete m_pInterForm; |
| 1529 m_pInterForm = nullptr; | 1529 m_pInterForm = nullptr; |
| 1530 m_Map.clear(); | 1530 m_Map.clear(); |
| 1531 } | 1531 } |
| 1532 | 1532 |
| (...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2232 int CPDFSDK_InterForm::BeforeFormImportData(const CPDF_InterForm* pForm) { | 2232 int CPDFSDK_InterForm::BeforeFormImportData(const CPDF_InterForm* pForm) { |
| 2233 return 0; | 2233 return 0; |
| 2234 } | 2234 } |
| 2235 | 2235 |
| 2236 int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) { | 2236 int CPDFSDK_InterForm::AfterFormImportData(const CPDF_InterForm* pForm) { |
| 2237 OnCalculate(nullptr); | 2237 OnCalculate(nullptr); |
| 2238 return 0; | 2238 return 0; |
| 2239 } | 2239 } |
| 2240 | 2240 |
| 2241 FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) { | 2241 FX_BOOL CPDFSDK_InterForm::IsNeedHighLight(int nFieldType) { |
| 2242 if (nFieldType < 1 || nFieldType > 6) | 2242 if (nFieldType < 1 || nFieldType > kNumFieldTypes) |
| 2243 return FALSE; | 2243 return FALSE; |
| 2244 return m_bNeedHightlight[nFieldType - 1]; | 2244 return m_bNeedHightlight[nFieldType - 1]; |
| 2245 } | 2245 } |
| 2246 | 2246 |
| 2247 void CPDFSDK_InterForm::RemoveAllHighLight() { | 2247 void CPDFSDK_InterForm::RemoveAllHighLight() { |
| 2248 memset((void*)m_bNeedHightlight, 0, 6 * sizeof(FX_BOOL)); | 2248 for (int i = 0; i < kNumFieldTypes; ++i) |
| 2249 m_bNeedHightlight[i] = FALSE; |
| 2249 } | 2250 } |
| 2251 |
| 2250 void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) { | 2252 void CPDFSDK_InterForm::SetHighlightColor(FX_COLORREF clr, int nFieldType) { |
| 2251 if (nFieldType < 0 || nFieldType > 6) | 2253 if (nFieldType < 0 || nFieldType > kNumFieldTypes) |
| 2252 return; | 2254 return; |
| 2253 switch (nFieldType) { | 2255 switch (nFieldType) { |
| 2254 case 0: { | 2256 case 0: { |
| 2255 for (int i = 0; i < 6; i++) { | 2257 for (int i = 0; i < kNumFieldTypes; ++i) { |
| 2256 m_aHighlightColor[i] = clr; | 2258 m_aHighlightColor[i] = clr; |
| 2257 m_bNeedHightlight[i] = TRUE; | 2259 m_bNeedHightlight[i] = TRUE; |
| 2258 } | 2260 } |
| 2259 break; | 2261 break; |
| 2260 } | 2262 } |
| 2261 default: { | 2263 default: { |
| 2262 m_aHighlightColor[nFieldType - 1] = clr; | 2264 m_aHighlightColor[nFieldType - 1] = clr; |
| 2263 m_bNeedHightlight[nFieldType - 1] = TRUE; | 2265 m_bNeedHightlight[nFieldType - 1] = TRUE; |
| 2264 break; | 2266 break; |
| 2265 } | 2267 } |
| 2266 } | 2268 } |
| 2267 } | 2269 } |
| 2268 | 2270 |
| 2269 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) { | 2271 FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(int nFieldType) { |
| 2270 if (nFieldType < 0 || nFieldType > 6) | 2272 if (nFieldType < 0 || nFieldType > kNumFieldTypes) |
| 2271 return FXSYS_RGB(255, 255, 255); | 2273 return FXSYS_RGB(255, 255, 255); |
| 2272 if (nFieldType == 0) | 2274 if (nFieldType == 0) |
| 2273 return m_aHighlightColor[0]; | 2275 return m_aHighlightColor[0]; |
| 2274 return m_aHighlightColor[nFieldType - 1]; | 2276 return m_aHighlightColor[nFieldType - 1]; |
| 2275 } | 2277 } |
| 2276 | 2278 |
| 2277 /* ------------------------- CBA_AnnotIterator ------------------------- */ | 2279 /* ------------------------- CBA_AnnotIterator ------------------------- */ |
| 2278 | 2280 |
| 2279 CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, | 2281 CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, |
| 2280 const CFX_ByteString& sType, | 2282 const CFX_ByteString& sType, |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2497 break; | 2499 break; |
| 2498 } | 2500 } |
| 2499 } | 2501 } |
| 2500 } | 2502 } |
| 2501 | 2503 |
| 2502 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { | 2504 CPDF_Rect CBA_AnnotIterator::GetAnnotRect(CPDFSDK_Annot* pAnnot) { |
| 2503 CPDF_Rect rcAnnot; | 2505 CPDF_Rect rcAnnot; |
| 2504 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); | 2506 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); |
| 2505 return rcAnnot; | 2507 return rcAnnot; |
| 2506 } | 2508 } |
| OLD | NEW |