| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdfsdk_baannot.h" | 7 #include "fpdfsdk/include/cpdfsdk_baannot.h" |
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 m_pAnnot->GetAnnotDict()->SetIntegerFor("StructParent", key); | 155 m_pAnnot->GetAnnotDict()->SetIntegerFor("StructParent", key); |
| 156 } | 156 } |
| 157 | 157 |
| 158 int CPDFSDK_BAAnnot::GetStructParent() const { | 158 int CPDFSDK_BAAnnot::GetStructParent() const { |
| 159 return m_pAnnot->GetAnnotDict()->GetIntegerFor("StructParent"); | 159 return m_pAnnot->GetAnnotDict()->GetIntegerFor("StructParent"); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // border | 162 // border |
| 163 void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { | 163 void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { |
| 164 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"); | 164 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border"); |
| 165 | |
| 166 if (pBorder) { | 165 if (pBorder) { |
| 167 pBorder->SetAt(2, new CPDF_Number(nWidth)); | 166 pBorder->SetAt(2, new CPDF_Number(nWidth)); |
| 168 } else { | 167 } else { |
| 169 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); | 168 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); |
| 170 | |
| 171 if (!pBSDict) { | 169 if (!pBSDict) { |
| 172 pBSDict = new CPDF_Dictionary; | 170 pBSDict = new CPDF_Dictionary; |
| 173 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); | 171 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); |
| 174 } | 172 } |
| 175 | |
| 176 pBSDict->SetIntegerFor("W", nWidth); | 173 pBSDict->SetIntegerFor("W", nWidth); |
| 177 } | 174 } |
| 178 } | 175 } |
| 179 | 176 |
| 180 int CPDFSDK_BAAnnot::GetBorderWidth() const { | 177 int CPDFSDK_BAAnnot::GetBorderWidth() const { |
| 181 if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border")) { | 178 if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayFor("Border")) |
| 182 return pBorder->GetIntegerAt(2); | 179 return pBorder->GetIntegerAt(2); |
| 183 } | 180 |
| 184 if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS")) { | 181 if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS")) |
| 185 return pBSDict->GetIntegerFor("W", 1); | 182 return pBSDict->GetIntegerFor("W", 1); |
| 186 } | 183 |
| 187 return 1; | 184 return 1; |
| 188 } | 185 } |
| 189 | 186 |
| 190 void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) { | 187 void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) { |
| 191 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); | 188 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); |
| 192 if (!pBSDict) { | 189 if (!pBSDict) { |
| 193 pBSDict = new CPDF_Dictionary; | 190 pBSDict = new CPDF_Dictionary; |
| 194 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); | 191 m_pAnnot->GetAnnotDict()->SetFor("BS", pBSDict); |
| 195 } | 192 } |
| 196 | 193 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 CPDF_RenderOptions* pOptions) { | 397 CPDF_RenderOptions* pOptions) { |
| 401 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); | 398 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
| 402 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 399 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 403 CPDF_Annot::Normal, nullptr); | 400 CPDF_Annot::Normal, nullptr); |
| 404 } | 401 } |
| 405 | 402 |
| 406 void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) { | 403 void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) { |
| 407 if (CPDF_Annot* pAnnot = m_pAnnot->GetPopupAnnot()) | 404 if (CPDF_Annot* pAnnot = m_pAnnot->GetPopupAnnot()) |
| 408 pAnnot->SetOpenState(bOpenState); | 405 pAnnot->SetOpenState(bOpenState); |
| 409 } | 406 } |
| OLD | NEW |