| 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 "../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 #include "../include/fsdk_mgr.h" | 9 #include "../include/fsdk_mgr.h" |
| 10 #include "../include/fsdk_baseannot.h" | 10 #include "../include/fsdk_baseannot.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 CPDFSDK_Widget::~CPDFSDK_Widget() | 35 CPDFSDK_Widget::~CPDFSDK_Widget() |
| 36 { | 36 { |
| 37 | 37 |
| 38 } | 38 } |
| 39 | 39 |
| 40 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMo
de mode) | 40 FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(CPDF_Annot::AppearanceMo
de mode) |
| 41 { | 41 { |
| 42 ASSERT(m_pAnnot != NULL); | 42 ASSERT(m_pAnnot != NULL); |
| 43 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 43 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
| 44 | 44 |
| 45 » CPDF_Dictionary* pAP = m_pAnnot->m_pAnnotDict->GetDict("AP"); | 45 » CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
| 46 if (pAP == NULL) return FALSE; | 46 if (pAP == NULL) return FALSE; |
| 47 | 47 |
| 48 // Choose the right sub-ap | 48 // Choose the right sub-ap |
| 49 const FX_CHAR* ap_entry = "N"; | 49 const FX_CHAR* ap_entry = "N"; |
| 50 if (mode == CPDF_Annot::Down) | 50 if (mode == CPDF_Annot::Down) |
| 51 ap_entry = "D"; | 51 ap_entry = "D"; |
| 52 else if (mode == CPDF_Annot::Rollover) | 52 else if (mode == CPDF_Annot::Rollover) |
| 53 ap_entry = "R"; | 53 ap_entry = "R"; |
| 54 if (!pAP->KeyExist(ap_entry)) | 54 if (!pAP->KeyExist(ap_entry)) |
| 55 ap_entry = "N"; | 55 ap_entry = "N"; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 ASSERT(pField != NULL); | 89 ASSERT(pField != NULL); |
| 90 | 90 |
| 91 return pField->GetFieldType(); | 91 return pField->GetFieldType(); |
| 92 } | 92 } |
| 93 | 93 |
| 94 int CPDFSDK_Widget::GetFieldFlags() const | 94 int CPDFSDK_Widget::GetFieldFlags() const |
| 95 { | 95 { |
| 96 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); | 96 CPDF_InterForm* pPDFInterForm = m_pInterForm->GetInterForm(); |
| 97 ASSERT(pPDFInterForm != NULL); | 97 ASSERT(pPDFInterForm != NULL); |
| 98 | 98 |
| 99 » CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnno
t->m_pAnnotDict); | 99 » CPDF_FormControl* pFormControl = pPDFInterForm->GetControlByDict(m_pAnno
t->GetAnnotDict()); |
| 100 CPDF_FormField* pFormField = pFormControl->GetField(); | 100 CPDF_FormField* pFormField = pFormControl->GetField(); |
| 101 return pFormField->GetFieldFlags(); | 101 return pFormField->GetFieldFlags(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 CFX_ByteString CPDFSDK_Widget::GetSubType() const | 104 CFX_ByteString CPDFSDK_Widget::GetSubType() const |
| 105 { | 105 { |
| 106 int nType = GetFieldType(); | 106 int nType = GetFieldType(); |
| 107 | 107 |
| 108 if (nType == FIELDTYPE_SIGNATURE) | 108 if (nType == FIELDTYPE_SIGNATURE) |
| 109 return BFFT_SIGNATURE; | 109 return BFFT_SIGNATURE; |
| (...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); | 1532 crFill = CPWL_Color(iColorType, fc[0], fc[1], fc[2], fc[3]); |
| 1533 | 1533 |
| 1534 return crFill; | 1534 return crFill; |
| 1535 } | 1535 } |
| 1536 | 1536 |
| 1537 void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St
ream* pImage) | 1537 void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_St
ream* pImage) |
| 1538 { | 1538 { |
| 1539 ASSERT(pImage != NULL); | 1539 ASSERT(pImage != NULL); |
| 1540 | 1540 |
| 1541 ASSERT(m_pAnnot != NULL); | 1541 ASSERT(m_pAnnot != NULL); |
| 1542 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1542 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
| 1543 | 1543 |
| 1544 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();//pDocument->GetDocu
ment(); | 1544 CPDF_Document* pDoc = m_pPageView->GetPDFDocument();//pDocument->GetDocu
ment(); |
| 1545 ASSERT(pDoc != NULL); | 1545 ASSERT(pDoc != NULL); |
| 1546 | 1546 |
| 1547 » CPDF_Dictionary* pAPDict = m_pAnnot->m_pAnnotDict->GetDict("AP"); | 1547 » CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
| 1548 ASSERT(pAPDict != NULL); | 1548 ASSERT(pAPDict != NULL); |
| 1549 | 1549 |
| 1550 CPDF_Stream* pStream = pAPDict->GetStream(sAPType); | 1550 CPDF_Stream* pStream = pAPDict->GetStream(sAPType); |
| 1551 ASSERT(pStream != NULL); | 1551 ASSERT(pStream != NULL); |
| 1552 | 1552 |
| 1553 CPDF_Dictionary* pStreamDict = pStream->GetDict(); | 1553 CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
| 1554 ASSERT(pStreamDict != NULL); | 1554 ASSERT(pStreamDict != NULL); |
| 1555 | 1555 |
| 1556 CFX_ByteString sImageAlias = "IMG"; | 1556 CFX_ByteString sImageAlias = "IMG"; |
| 1557 | 1557 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1573 { | 1573 { |
| 1574 CPDF_Dictionary* pXObject = new CPDF_Dictionary; | 1574 CPDF_Dictionary* pXObject = new CPDF_Dictionary; |
| 1575 pXObject->SetAtReference(sImageAlias, pDoc, pImage); | 1575 pXObject->SetAtReference(sImageAlias, pDoc, pImage); |
| 1576 pStreamResList->SetAt("XObject", pXObject); | 1576 pStreamResList->SetAt("XObject", pXObject); |
| 1577 } | 1577 } |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) | 1580 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) |
| 1581 { | 1581 { |
| 1582 ASSERT(m_pAnnot != NULL); | 1582 ASSERT(m_pAnnot != NULL); |
| 1583 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1583 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
| 1584 | 1584 |
| 1585 » if (CPDF_Dictionary* pAPDict = m_pAnnot->m_pAnnotDict->GetDict("AP")) | 1585 » if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP")) |
| 1586 { | 1586 { |
| 1587 pAPDict->RemoveAt(sAPType); | 1587 pAPDict->RemoveAt(sAPType); |
| 1588 } | 1588 } |
| 1589 } | 1589 } |
| 1590 | 1590 |
| 1591 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAc
tion& data, CPDFSDK_PageView* pPageView) | 1591 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAc
tion& data, CPDFSDK_PageView* pPageView) |
| 1592 { | 1592 { |
| 1593 CPDF_Action action = GetAAction(type); | 1593 CPDF_Action action = GetAAction(type); |
| 1594 | 1594 |
| 1595 if (action && action.GetType() != CPDF_Action::Unknown) | 1595 if (action && action.GetType() != CPDF_Action::Unknown) |
| (...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2993 | 2993 |
| 2994 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 2994 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 2995 ASSERT(pPDFAnnot != NULL); | 2995 ASSERT(pPDFAnnot != NULL); |
| 2996 | 2996 |
| 2997 CPDF_Rect rcAnnot; | 2997 CPDF_Rect rcAnnot; |
| 2998 pPDFAnnot->GetRect(rcAnnot); | 2998 pPDFAnnot->GetRect(rcAnnot); |
| 2999 | 2999 |
| 3000 return rcAnnot; | 3000 return rcAnnot; |
| 3001 } | 3001 } |
| 3002 | 3002 |
| OLD | NEW |