| 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 "core/fpdfdoc/include/cpdf_annotlist.h" | 7 #include "core/fpdfdoc/include/cpdf_annotlist.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 CFX_FloatRect rect = pParentDict->GetRectBy("Rect"); | 37 CFX_FloatRect rect = pParentDict->GetRectBy("Rect"); |
| 38 rect.Normalize(); | 38 rect.Normalize(); |
| 39 CFX_FloatRect popupRect(0, 0, 200, 200); | 39 CFX_FloatRect popupRect(0, 0, 200, 200); |
| 40 popupRect.Translate(rect.left, rect.bottom - popupRect.Height()); | 40 popupRect.Translate(rect.left, rect.bottom - popupRect.Height()); |
| 41 | 41 |
| 42 pAnnotDict->SetAtRect("Rect", popupRect); | 42 pAnnotDict->SetAtRect("Rect", popupRect); |
| 43 pAnnotDict->SetAtInteger("F", 0); | 43 pAnnotDict->SetAtInteger("F", 0); |
| 44 | 44 |
| 45 std::unique_ptr<CPDF_Annot> pPopupAnnot( | 45 std::unique_ptr<CPDF_Annot> pPopupAnnot( |
| 46 new CPDF_Annot(pAnnotDict, pDocument)); | 46 new CPDF_Annot(pAnnotDict, pDocument, true)); |
| 47 pAnnot->SetPopupAnnot(pPopupAnnot.get()); | 47 pAnnot->SetPopupAnnot(pPopupAnnot.get()); |
| 48 return pPopupAnnot; | 48 return pPopupAnnot; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) | 53 CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) |
| 54 : m_pDocument(pPage->m_pDocument) { | 54 : m_pDocument(pPage->m_pDocument) { |
| 55 if (!pPage->m_pFormDict) | 55 if (!pPage->m_pFormDict) |
| 56 return; | 56 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 76 pAnnots->RemoveAt(i + 1); | 76 pAnnots->RemoveAt(i + 1); |
| 77 pDict = pAnnots->GetDictAt(i); | 77 pDict = pAnnots->GetDictAt(i); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Skip creating Popup annotation in the PDF document since PDFium provides | 80 // Skip creating Popup annotation in the PDF document since PDFium provides |
| 81 // its own Popup annotations. | 81 // its own Popup annotations. |
| 82 if (pDict->GetStringBy("Subtype") == "Popup") | 82 if (pDict->GetStringBy("Subtype") == "Popup") |
| 83 continue; | 83 continue; |
| 84 | 84 |
| 85 m_AnnotList.push_back( | 85 m_AnnotList.push_back( |
| 86 std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument))); | 86 std::unique_ptr<CPDF_Annot>(new CPDF_Annot(pDict, m_pDocument, false))); |
| 87 if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" && | 87 if (bRegenerateAP && pDict->GetStringBy("Subtype") == "Widget" && |
| 88 CPDF_InterForm::IsUpdateAPEnabled()) { | 88 CPDF_InterForm::IsUpdateAPEnabled()) { |
| 89 FPDF_GenerateAP(m_pDocument, pDict); | 89 FPDF_GenerateAP(m_pDocument, pDict); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 size_t nAnnotListSize = m_AnnotList.size(); | 93 size_t nAnnotListSize = m_AnnotList.size(); |
| 94 for (size_t i = 0; i < nAnnotListSize; ++i) { | 94 for (size_t i = 0; i < nAnnotListSize; ++i) { |
| 95 std::unique_ptr<CPDF_Annot> pPopupAnnot( | 95 std::unique_ptr<CPDF_Annot> pPopupAnnot( |
| 96 CreatePopupAnnot(m_AnnotList[i].get(), m_pDocument)); | 96 CreatePopupAnnot(m_AnnotList[i].get(), m_pDocument)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 CPDF_RenderContext* pContext, | 173 CPDF_RenderContext* pContext, |
| 174 FX_BOOL bPrinting, | 174 FX_BOOL bPrinting, |
| 175 CFX_Matrix* pMatrix, | 175 CFX_Matrix* pMatrix, |
| 176 FX_BOOL bShowWidget, | 176 FX_BOOL bShowWidget, |
| 177 CPDF_RenderOptions* pOptions) { | 177 CPDF_RenderOptions* pOptions) { |
| 178 uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN | 178 uint32_t dwAnnotFlags = bShowWidget ? ANNOTFLAG_INVISIBLE | ANNOTFLAG_HIDDEN |
| 179 : ANNOTFLAG_INVISIBLE; | 179 : ANNOTFLAG_INVISIBLE; |
| 180 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, dwAnnotFlags, | 180 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, dwAnnotFlags, |
| 181 pOptions, nullptr); | 181 pOptions, nullptr); |
| 182 } | 182 } |
| OLD | NEW |