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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 if (pBorder->GetCount() >= 4) { | 724 if (pBorder->GetCount() >= 4) { |
725 CPDF_Array* pDP = pBorder->GetArrayAt(3); | 725 CPDF_Array* pDP = pBorder->GetArrayAt(3); |
726 if (pDP && pDP->GetCount() > 0) | 726 if (pDP && pDP->GetCount() > 0) |
727 return BBS_DASH; | 727 return BBS_DASH; |
728 } | 728 } |
729 } | 729 } |
730 | 730 |
731 return BBS_SOLID; | 731 return BBS_SOLID; |
732 } | 732 } |
733 | 733 |
734 void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) { | |
735 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); | |
736 if (!pBSDict) { | |
737 pBSDict = new CPDF_Dictionary; | |
738 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); | |
739 } | |
740 | |
741 CPDF_Array* pArray = new CPDF_Array; | |
742 for (size_t i = 0, sz = array.GetSize(); i < sz; i++) | |
743 pArray->AddInteger(array[i]); | |
744 | |
745 pBSDict->SetAt("D", pArray); | |
746 } | |
747 | |
748 void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const { | |
749 CPDF_Array* pDash = NULL; | |
750 | |
751 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); | |
752 if (pBorder) { | |
753 pDash = pBorder->GetArrayAt(3); | |
754 } else { | |
755 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); | |
756 if (pBSDict) { | |
757 pDash = pBSDict->GetArrayBy("D"); | |
758 } | |
759 } | |
760 | |
761 if (pDash) { | |
762 for (size_t i = 0, sz = pDash->GetCount(); i < sz; i++) | |
763 array.Add(pDash->GetIntegerAt(i)); | |
764 } | |
765 } | |
766 | |
767 void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { | 734 void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { |
768 CPDF_Array* pArray = new CPDF_Array; | 735 CPDF_Array* pArray = new CPDF_Array; |
769 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); | 736 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); |
770 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); | 737 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); |
771 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); | 738 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); |
772 m_pAnnot->GetAnnotDict()->SetAt("C", pArray); | 739 m_pAnnot->GetAnnotDict()->SetAt("C", pArray); |
773 } | 740 } |
774 | 741 |
775 void CPDFSDK_BAAnnot::RemoveColor() { | 742 void CPDFSDK_BAAnnot::RemoveColor() { |
776 m_pAnnot->GetAnnotDict()->RemoveAt("C"); | 743 m_pAnnot->GetAnnotDict()->RemoveAt("C"); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 | 921 |
955 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 922 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
956 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 923 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
957 } | 924 } |
958 | 925 |
959 #ifdef PDF_ENABLE_XFA | 926 #ifdef PDF_ENABLE_XFA |
960 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 927 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
961 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 928 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
962 } | 929 } |
963 #endif // PDF_ENABLE_XFA | 930 #endif // PDF_ENABLE_XFA |
OLD | NEW |