summaryrefslogtreecommitdiff
path: root/vcl/source/graphic
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-01-20 21:14:53 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-01-21 09:14:09 +0100
commit47fbbdaf091ea0ec0fb692340ad11f0d4c0f2d5c (patch)
treecea0f4db43e71b116b7840c0b090aed616bb5052 /vcl/source/graphic
parentbd6214e2aa6f25e013eef769529b75c1e3b580cb (diff)
pdfium: use PDFiumDocument in VectorGraphicSearch::Implementation
Which means no need to manually close the doc in the dtor. Change-Id: Icf1357f162313a845d7694323d546a6fccad344e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109724 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl/source/graphic')
-rw-r--r--vcl/source/graphic/VectorGraphicSearch.cxx18
1 files changed, 5 insertions, 13 deletions
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index c5e04060bc1b..40dcbad0da10 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -203,23 +203,16 @@ class VectorGraphicSearch::Implementation
{
public:
std::shared_ptr<vcl::pdf::PDFium> mpPDFium;
- FPDF_DOCUMENT mpPdfDocument;
+ std::unique_ptr<vcl::pdf::PDFiumDocument> mpPdfDocument;
std::unique_ptr<SearchContext> mpSearchContext;
Implementation()
: mpPDFium(vcl::pdf::PDFiumLibrary::get())
- , mpPdfDocument(nullptr)
{
}
- ~Implementation()
- {
- mpSearchContext.reset();
-
- if (mpPdfDocument)
- FPDF_CloseDocument(mpPdfDocument);
- }
+ ~Implementation() { mpSearchContext.reset(); }
};
VectorGraphicSearch::VectorGraphicSearch(Graphic const& rGraphic)
@@ -251,9 +244,8 @@ bool VectorGraphicSearch::search(OUString const& rSearchString,
bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rData)
{
- mpImplementation->mpPdfDocument
- = FPDF_LoadMemDocument(rData->getBinaryDataContainer().getData(),
- rData->getBinaryDataContainer().getSize(), /*password=*/nullptr);
+ mpImplementation->mpPdfDocument = mpImplementation->mpPDFium->openDocument(
+ rData->getBinaryDataContainer().getData(), rData->getBinaryDataContainer().getSize());
if (!mpImplementation->mpPdfDocument)
{
@@ -283,7 +275,7 @@ bool VectorGraphicSearch::searchPDF(std::shared_ptr<VectorGraphicData> const& rD
sal_Int32 nPageIndex = std::max(rData->getPageIndex(), sal_Int32(0));
mpImplementation->mpSearchContext.reset(
- new SearchContext(mpImplementation->mpPdfDocument, nPageIndex));
+ new SearchContext(mpImplementation->mpPdfDocument->getPointer(), nPageIndex));
return true;
}