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 "public/fpdf_edit.h" | 7 #include "public/fpdf_edit.h" |
8 | 8 |
9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 #include "public/fpdf_formfill.h" | 10 #include "public/fpdf_formfill.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 128 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
129 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 129 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || |
130 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 130 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
131 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 131 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
132 "Page")) { | 132 "Page")) { |
133 return; | 133 return; |
134 } | 134 } |
135 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj; | 135 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_obj; |
136 if (!pPageObj) | 136 if (!pPageObj) |
137 return; | 137 return; |
138 FX_POSITION LastPersition = pPage->GetLastObjectPosition(); | 138 FX_POSITION LastPersition = pPage->GetPageObjectList()->GetTailPosition(); |
139 | 139 |
140 pPage->InsertObject(LastPersition, pPageObj); | 140 pPage->GetPageObjectList()->InsertObject(LastPersition, pPageObj); |
141 switch (pPageObj->m_Type) { | 141 switch (pPageObj->m_Type) { |
142 case FPDF_PAGEOBJ_PATH: { | 142 case FPDF_PAGEOBJ_PATH: { |
143 CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; | 143 CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; |
144 pPathObj->CalcBoundingBox(); | 144 pPathObj->CalcBoundingBox(); |
145 break; | 145 break; |
146 } | 146 } |
147 case FPDF_PAGEOBJ_TEXT: { | 147 case FPDF_PAGEOBJ_TEXT: { |
148 // CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; | 148 // CPDF_PathObject* pPathObj = (CPDF_PathObject*)pPageObj; |
149 // pPathObj->CalcBoundingBox(); | 149 // pPathObj->CalcBoundingBox(); |
150 break; | 150 break; |
(...skipping 19 matching lines...) Expand all Loading... |
170 } | 170 } |
171 | 171 |
172 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { | 172 DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page) { |
173 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 173 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
174 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 174 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || |
175 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 175 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
176 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 176 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
177 "Page")) { | 177 "Page")) { |
178 return -1; | 178 return -1; |
179 } | 179 } |
180 return pPage->CountObjects(); | 180 return pPage->GetPageObjectList()->GetCount(); |
181 } | 181 } |
182 | 182 |
183 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, | 183 DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, |
184 int index) { | 184 int index) { |
185 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 185 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
186 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || | 186 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || |
187 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 187 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
188 "Page")) { | 188 "Page")) { |
189 return NULL; | 189 return NULL; |
190 } | 190 } |
191 return pPage->GetObjectByIndex(index); | 191 return pPage->GetPageObjectList()->GetObjectByIndex(index); |
192 } | 192 } |
193 | 193 |
194 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) { | 194 DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) { |
195 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 195 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
196 return pPage && pPage->BackgroundAlphaNeeded(); | 196 return pPage && pPage->BackgroundAlphaNeeded(); |
197 } | 197 } |
198 | 198 |
199 DLLEXPORT FPDF_BOOL STDCALL | 199 DLLEXPORT FPDF_BOOL STDCALL |
200 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { | 200 FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { |
201 if (!pageObject) | 201 if (!pageObject) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || | 303 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || |
304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( | 304 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( |
305 "Page")) { | 305 "Page")) { |
306 return; | 306 return; |
307 } | 307 } |
308 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 308 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
309 rotate %= 4; | 309 rotate %= 4; |
310 | 310 |
311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); | 311 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); |
312 } | 312 } |
OLD | NEW |