1 // Copyright 2016 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "core/fpdfapi/page/cpdf_formobject.h" 8 9 #include <utility> 10 11 #include "core/fpdfapi/page/cpdf_form.h" 12 CPDF_FormObject(int32_t content_stream,std::unique_ptr<CPDF_Form> pForm,const CFX_Matrix & matrix)13CPDF_FormObject::CPDF_FormObject(int32_t content_stream, 14 std::unique_ptr<CPDF_Form> pForm, 15 const CFX_Matrix& matrix) 16 : CPDF_PageObject(content_stream), 17 m_pForm(std::move(pForm)), 18 m_FormMatrix(matrix) {} 19 ~CPDF_FormObject()20CPDF_FormObject::~CPDF_FormObject() {} 21 Transform(const CFX_Matrix & matrix)22void CPDF_FormObject::Transform(const CFX_Matrix& matrix) { 23 m_FormMatrix.Concat(matrix); 24 CalcBoundingBox(); 25 } 26 IsForm() const27bool CPDF_FormObject::IsForm() const { 28 return true; 29 } 30 AsForm()31CPDF_FormObject* CPDF_FormObject::AsForm() { 32 return this; 33 } 34 AsForm() const35const CPDF_FormObject* CPDF_FormObject::AsForm() const { 36 return this; 37 } 38 GetType() const39CPDF_PageObject::Type CPDF_FormObject::GetType() const { 40 return FORM; 41 } 42 CalcBoundingBox()43void CPDF_FormObject::CalcBoundingBox() { 44 SetRect(m_FormMatrix.TransformRect(m_pForm->CalcBoundingBox())); 45 } 46