include/vcl/filter/PDFiumLibrary.hxx | 2 ++ vcl/source/graphic/VectorGraphicSearch.cxx | 5 +---- vcl/source/pdf/PDFiumLibrary.cxx | 8 ++++++++ 3 files changed, 11 insertions(+), 4 deletions(-)
New commits: commit 76f878e299796db2bf3f31b2519a87e6ca232609 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Feb 2 21:09:53 2021 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Feb 3 09:26:54 2021 +0100 pdfium: add a FPDFText_FindStart() wrapper Change-Id: I0bf77c116ab83ea557467da7f0c780d92db6a60e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110333 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx index 418feede99b6..667fa614da70 100644 --- a/include/vcl/filter/PDFiumLibrary.hxx +++ b/include/vcl/filter/PDFiumLibrary.hxx @@ -180,6 +180,8 @@ public: int countChars(); unsigned int getUnicode(int index); + std::unique_ptr<PDFiumSearchHandle> findStart(const OUString& rFindWhat, sal_uInt64 nFlags, + sal_Int32 nStartIndex); }; class VCL_DLLPUBLIC PDFiumPage final diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx index 3ac33db37cc3..01b76fb28b06 100644 --- a/vcl/source/graphic/VectorGraphicSearch.cxx +++ b/vcl/source/graphic/VectorGraphicSearch.cxx @@ -95,8 +95,6 @@ public: if (!mpTextPage) return false; - FPDF_WIDESTRING pString = reinterpret_cast<FPDF_WIDESTRING>(maSearchString.getStr()); - // Index where to start to search. -1 => at the end int nStartIndex = maOptions.meStartPosition == SearchStartPosition::End ? -1 : 0; @@ -113,8 +111,7 @@ public: if (maOptions.mbMatchWholeWord) nSearchFlags |= FPDF_MATCHWHOLEWORD; - mpSearchHandle = std::make_unique<vcl::pdf::PDFiumSearchHandle>( - FPDFText_FindStart(mpTextPage->getPointer(), pString, nSearchFlags, nStartIndex)); + mpSearchHandle = mpTextPage->findStart(maSearchString, nSearchFlags, nStartIndex); return mpSearchHandle != nullptr; } diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx index fce8d4d539bd..c1571682f4b3 100644 --- a/vcl/source/pdf/PDFiumLibrary.cxx +++ b/vcl/source/pdf/PDFiumLibrary.cxx @@ -1100,6 +1100,14 @@ unsigned int PDFiumTextPage::getUnicode(int index) return FPDFText_GetUnicode(mpTextPage, index); } +std::unique_ptr<PDFiumSearchHandle> +PDFiumTextPage::findStart(const OUString& rFindWhat, sal_uInt64 nFlags, sal_Int32 nStartIndex) +{ + FPDF_WIDESTRING pFindWhat = reinterpret_cast<FPDF_WIDESTRING>(rFindWhat.getStr()); + return std::make_unique<vcl::pdf::PDFiumSearchHandle>( + FPDFText_FindStart(mpTextPage, pFindWhat, nFlags, nStartIndex)); +} + PDFiumSearchHandle::PDFiumSearchHandle(FPDF_SCHHANDLE pSearchHandle) : mpSearchHandle(pSearchHandle) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits