diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-01-27 20:38:39 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-01-28 09:02:34 +0100 |
commit | 8f0b4aacf13c8d096a87a61b5f573a77e08c96c6 (patch) | |
tree | 2299a0c8044ac51257ddf497b86cd4a62c390fb9 /vcl | |
parent | 380a158f4c8bdacff9ed7b5327e9b65781f7b928 (diff) |
pdfium: use PDFiumTextPage in SearchContext
Change-Id: I12332ac101ecb3c92a343c8bd9a038b0238b6791
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110030
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/graphic/VectorGraphicSearch.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx index b835962e25ef..083dc6cf2741 100644 --- a/vcl/source/graphic/VectorGraphicSearch.cxx +++ b/vcl/source/graphic/VectorGraphicSearch.cxx @@ -29,7 +29,7 @@ class SearchContext private: std::unique_ptr<vcl::pdf::PDFiumDocument>& mpPdfDocument; std::unique_ptr<vcl::pdf::PDFiumPage> mpPage; - FPDF_TEXTPAGE mpTextPage; + std::unique_ptr<vcl::pdf::PDFiumTextPage> mpTextPage; FPDF_SCHHANDLE mpSearchHandle; public: @@ -40,7 +40,6 @@ public: SearchContext(std::unique_ptr<vcl::pdf::PDFiumDocument>& pPdfDocument, sal_Int32 nPageIndex) : mpPdfDocument(pPdfDocument) - , mpTextPage(nullptr) , mpSearchHandle(nullptr) , mnPageIndex(nPageIndex) , mnCurrentIndex(-1) @@ -52,7 +51,7 @@ public: if (mpSearchHandle) FPDFText_FindClose(mpSearchHandle); if (mpTextPage) - FPDFText_ClosePage(mpTextPage); + mpTextPage.reset(); if (mpPage) mpPage.reset(); } @@ -81,7 +80,7 @@ public: FPDFText_FindClose(mpSearchHandle); if (mpTextPage) - FPDFText_ClosePage(mpTextPage); + mpTextPage.reset(); if (mpPage) mpPage.reset(); @@ -93,7 +92,7 @@ public: if (!mpPage) return false; - mpTextPage = FPDFText_LoadPage(mpPage->getPointer()); + mpTextPage = mpPage->getTextPage(); if (!mpTextPage) return false; @@ -115,7 +114,8 @@ public: if (maOptions.mbMatchWholeWord) nSearchFlags |= FPDF_MATCHWHOLEWORD; - mpSearchHandle = FPDFText_FindStart(mpTextPage, pString, nSearchFlags, nStartIndex); + mpSearchHandle + = FPDFText_FindStart(mpTextPage->getPointer(), pString, nSearchFlags, nStartIndex); return mpSearchHandle != nullptr; } @@ -178,7 +178,8 @@ public: double bottom = 0.0; double top = 0.0; - if (FPDFText_GetCharBox(mpTextPage, nIndex + nCount, &left, &right, &bottom, &top)) + if (FPDFText_GetCharBox(mpTextPage->getPointer(), nIndex + nCount, &left, &right, + &bottom, &top)) { left = convertPointToMm100(left); right = convertPointToMm100(right); |