Chromium Code Reviews| 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_number.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
| 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 11 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" |
| 12 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 12 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
| 13 #include "fpdfsdk/include/cpdfsdk_datetime.h" | 13 #include "fpdfsdk/include/cpdfsdk_datetime.h" |
| 14 #include "fpdfsdk/include/fsdk_mgr.h" | 14 #include "fpdfsdk/include/fsdk_mgr.h" |
| 15 | 15 |
| 16 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, | 16 CPDFSDK_BAAnnot::CPDFSDK_BAAnnot(CPDF_Annot* pAnnot, |
| 17 CPDFSDK_PageView* pPageView) | 17 CPDFSDK_PageView* pPageView) |
| 18 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} | 18 : CPDFSDK_Annot(pPageView), m_pAnnot(pAnnot) {} |
| 19 | 19 |
| 20 CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {} | 20 CPDFSDK_BAAnnot::~CPDFSDK_BAAnnot() {} |
| 21 | 21 |
| 22 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { | 22 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFAnnot() const { |
| 23 return m_pAnnot; | 23 return m_pAnnot; |
| 24 } | 24 } |
| 25 | 25 |
| 26 CPDF_Annot* CPDFSDK_BAAnnot::GetPDFPopupAnnot() const { | |
| 27 return m_pAnnot->GetPopupAnnot(); | |
| 28 } | |
| 29 | |
| 26 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { | 30 CPDF_Dictionary* CPDFSDK_BAAnnot::GetAnnotDict() const { |
| 27 return m_pAnnot->GetAnnotDict(); | 31 return m_pAnnot->GetAnnotDict(); |
| 28 } | 32 } |
| 29 | 33 |
| 30 void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) { | 34 void CPDFSDK_BAAnnot::SetRect(const CFX_FloatRect& rect) { |
| 31 ASSERT(rect.right - rect.left >= GetMinWidth()); | 35 ASSERT(rect.right - rect.left >= GetMinWidth()); |
| 32 ASSERT(rect.top - rect.bottom >= GetMinHeight()); | 36 ASSERT(rect.top - rect.bottom >= GetMinHeight()); |
| 33 | 37 |
| 34 m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); | 38 m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); |
| 35 } | 39 } |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 return CPDF_Action(); | 399 return CPDF_Action(); |
| 396 } | 400 } |
| 397 | 401 |
| 398 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, | 402 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, |
| 399 CFX_Matrix* pUser2Device, | 403 CFX_Matrix* pUser2Device, |
| 400 CPDF_RenderOptions* pOptions) { | 404 CPDF_RenderOptions* pOptions) { |
| 401 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); | 405 m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal); |
| 402 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 406 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
| 403 CPDF_Annot::Normal, nullptr); | 407 CPDF_Annot::Normal, nullptr); |
| 404 } | 408 } |
| 409 | |
| 410 void CPDFSDK_BAAnnot::SetOpenState(bool bOpenState) { | |
| 411 if (!m_pAnnot->GetPopupAnnot()) | |
| 412 return; | |
| 413 | |
|
dsinclair
2016/08/24 14:00:20
if (CPDF_Annot* pAnnot = m_pAnnot->GetPopupAnnot()
jaepark
2016/08/24 18:37:49
Done.
| |
| 414 m_pAnnot->GetPopupAnnot()->SetOpenState(bOpenState); | |
| 415 } | |
| OLD | NEW |