diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-11-10 21:12:29 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-11-11 08:33:33 +0100 |
commit | 97e9df169c183ce1fb6530e8f3e806036a25bf68 (patch) | |
tree | 4198c1c731f1f6f59ba8b96decaffd6ffc040b2b /vcl/source/pdf | |
parent | 98076bc83167dca559800ea882c38ef4fca873b7 (diff) |
pdfium: eliminate remaining direct calls to FPDFPageObj_GetType()
And also introduce an enum class for the return type.
Change-Id: I6577c7678889ac5bb8efbf0d0cfeb575aac06e27
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105567
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl/source/pdf')
-rw-r--r-- | vcl/source/pdf/PDFiumLibrary.cxx | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index 69facd1bf001..ae1588e4a268 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -26,6 +26,19 @@ #include <bitmapwriteaccess.hxx> +static_assert(static_cast<int>(vcl::pdf::PDFPageObjectType::Unknown) == FPDF_PAGEOBJ_UNKNOWN, + "PDFPageObjectType::Unknown value mismatch"); +static_assert(static_cast<int>(vcl::pdf::PDFPageObjectType::Text) == FPDF_PAGEOBJ_TEXT, + "PDFPageObjectType::Text value mismatch"); +static_assert(static_cast<int>(vcl::pdf::PDFPageObjectType::Path) == FPDF_PAGEOBJ_PATH, + "PDFPageObjectType::Path value mismatch"); +static_assert(static_cast<int>(vcl::pdf::PDFPageObjectType::Image) == FPDF_PAGEOBJ_IMAGE, + "PDFPageObjectType::Image value mismatch"); +static_assert(static_cast<int>(vcl::pdf::PDFPageObjectType::Shading) == FPDF_PAGEOBJ_SHADING, + "PDFPageObjectType::Shading value mismatch"); +static_assert(static_cast<int>(vcl::pdf::PDFPageObjectType::Form) == FPDF_PAGEOBJ_FORM, + "PDFPageObjectType::Form value mismatch"); + namespace { /// Callback class to be used with FPDF_SaveWithVersion(). @@ -310,14 +323,13 @@ OUString PDFiumPageObject::getText(std::unique_ptr<PDFiumTextPage> const& pTextP return sReturnText; } -int PDFiumPageObject::getType() { return FPDFPageObj_GetType(mpPageObject); } - -int PDFiumPageObject::getFormObjectCount() +PDFPageObjectType PDFiumPageObject::getType() { - return FPDFFormObj_CountObjects(mpPageObject); - ; + return static_cast<PDFPageObjectType>(FPDFPageObj_GetType(mpPageObject)); } +int PDFiumPageObject::getFormObjectCount() { return FPDFFormObj_CountObjects(mpPageObject); } + std::unique_ptr<PDFiumPageObject> PDFiumPageObject::getFormObject(int nIndex) { std::unique_ptr<PDFiumPageObject> pPDFiumFormObject; |