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_doc.h" | 7 #include "public/fpdf_doc.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 FPDF_ACTION pDict) { | 167 FPDF_ACTION pDict) { |
168 if (!pDict) | 168 if (!pDict) |
169 return nullptr; | 169 return nullptr; |
170 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 170 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
171 if (!pDoc) | 171 if (!pDoc) |
172 return nullptr; | 172 return nullptr; |
173 CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); | 173 CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); |
174 return action.GetDest(pDoc).GetObject(); | 174 return action.GetDest(pDoc).GetObject(); |
175 } | 175 } |
176 | 176 |
177 DLLEXPORT unsigned long STDCALL | 177 DLLEXPORT unsigned long STDCALL FPDFAction_GetFilePath(FPDF_ACTION pDict, |
178 FPDFAction_GetFilePath(FPDF_ACTION pDict, void* buffer, unsigned long buflen) { | 178 void* buffer, |
| 179 unsigned long buflen) { |
179 unsigned long type = FPDFAction_GetType(pDict); | 180 unsigned long type = FPDFAction_GetType(pDict); |
180 if (type != PDFACTION_REMOTEGOTO && type != PDFACTION_LAUNCH) | 181 if (type != PDFACTION_REMOTEGOTO && type != PDFACTION_LAUNCH) |
181 return 0; | 182 return 0; |
182 | 183 |
183 CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); | 184 CPDF_Action action(ToDictionary(static_cast<CPDF_Object*>(pDict))); |
184 CFX_ByteString path = action.GetFilePath().UTF8Encode(); | 185 CFX_ByteString path = action.GetFilePath().UTF8Encode(); |
185 unsigned long len = path.GetLength() + 1; | 186 unsigned long len = path.GetLength() + 1; |
186 if (buffer && buflen >= len) | 187 if (buffer && buflen >= len) |
187 FXSYS_memcpy(buffer, path.c_str(), len); | 188 FXSYS_memcpy(buffer, path.c_str(), len); |
188 return len; | 189 return len; |
(...skipping 20 matching lines...) Expand all Loading... |
209 FPDF_DEST pDict) { | 210 FPDF_DEST pDict) { |
210 if (!pDict) | 211 if (!pDict) |
211 return 0; | 212 return 0; |
212 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); | 213 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
213 if (!pDoc) | 214 if (!pDoc) |
214 return 0; | 215 return 0; |
215 CPDF_Dest dest(static_cast<CPDF_Array*>(pDict)); | 216 CPDF_Dest dest(static_cast<CPDF_Array*>(pDict)); |
216 return dest.GetPageIndex(pDoc); | 217 return dest.GetPageIndex(pDoc); |
217 } | 218 } |
218 | 219 |
219 DLLEXPORT FPDF_LINK STDCALL | 220 DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, |
220 FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, double y) { | 221 double x, |
| 222 double y) { |
221 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 223 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
222 if (!pPage) | 224 if (!pPage) |
223 return nullptr; | 225 return nullptr; |
224 | 226 |
225 CPDF_LinkList* pLinkList = GetLinkList(pPage); | 227 CPDF_LinkList* pLinkList = GetLinkList(pPage); |
226 if (!pLinkList) | 228 if (!pLinkList) |
227 return nullptr; | 229 return nullptr; |
228 | 230 |
229 return pLinkList->GetLinkAtPoint(pPage, (FX_FLOAT)x, (FX_FLOAT)y, nullptr) | 231 return pLinkList->GetLinkAtPoint(pPage, (FX_FLOAT)x, (FX_FLOAT)y, nullptr) |
230 .GetDict(); | 232 .GetDict(); |
231 } | 233 } |
232 | 234 |
233 DLLEXPORT int STDCALL | 235 DLLEXPORT int STDCALL FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, |
234 FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y) { | 236 double x, |
| 237 double y) { |
235 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); | 238 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
236 if (!pPage) | 239 if (!pPage) |
237 return -1; | 240 return -1; |
238 | 241 |
239 CPDF_LinkList* pLinkList = GetLinkList(pPage); | 242 CPDF_LinkList* pLinkList = GetLinkList(pPage); |
240 if (!pLinkList) | 243 if (!pLinkList) |
241 return -1; | 244 return -1; |
242 | 245 |
243 int z_order = -1; | 246 int z_order = -1; |
244 pLinkList->GetLinkAtPoint(pPage, (FX_FLOAT)x, (FX_FLOAT)y, &z_order); | 247 pLinkList->GetLinkAtPoint(pPage, (FX_FLOAT)x, (FX_FLOAT)y, &z_order); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return 0; | 363 return 0; |
361 CFX_WideString text = pInfo->GetUnicodeTextBy(tag); | 364 CFX_WideString text = pInfo->GetUnicodeTextBy(tag); |
362 // Use UTF-16LE encoding | 365 // Use UTF-16LE encoding |
363 CFX_ByteString encodedText = text.UTF16LE_Encode(); | 366 CFX_ByteString encodedText = text.UTF16LE_Encode(); |
364 unsigned long len = encodedText.GetLength(); | 367 unsigned long len = encodedText.GetLength(); |
365 if (buffer && buflen >= len) { | 368 if (buffer && buflen >= len) { |
366 FXSYS_memcpy(buffer, encodedText.c_str(), len); | 369 FXSYS_memcpy(buffer, encodedText.c_str(), len); |
367 } | 370 } |
368 return len; | 371 return len; |
369 } | 372 } |
OLD | NEW |