summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/graphic/VectorGraphicSearch.cxx16
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx21
2 files changed, 24 insertions, 13 deletions
diff --git a/vcl/source/graphic/VectorGraphicSearch.cxx b/vcl/source/graphic/VectorGraphicSearch.cxx
index aabfd220f651..09839c3524ef 100644
--- a/vcl/source/graphic/VectorGraphicSearch.cxx
+++ b/vcl/source/graphic/VectorGraphicSearch.cxx
@@ -169,20 +169,10 @@ public:
for (int nCount = 0; nCount < nSize; nCount++)
{
- double left = 0.0;
- double right = 0.0;
- double bottom = 0.0;
- double top = 0.0;
-
- if (FPDFText_GetCharBox(mpTextPage->getPointer(), nIndex + nCount, &left, &right,
- &bottom, &top))
+ basegfx::B2DRectangle aRectangle = mpTextPage->getCharBox(nIndex + nCount, fPageHeight);
+ if (!aRectangle.isEmpty())
{
- left = convertPointToMm100(left);
- right = convertPointToMm100(right);
- top = fPageHeight - convertPointToMm100(top);
- bottom = fPageHeight - convertPointToMm100(bottom);
-
- aRectangles.emplace_back(left, bottom, right, top);
+ aRectangles.push_back(aRectangle);
}
}
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 278fb284901d..c14a73ddd469 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -24,6 +24,7 @@
#include <osl/endian.h>
#include <vcl/bitmap.hxx>
#include <tools/stream.hxx>
+#include <tools/UnitConversion.hxx>
#include <bitmap/BitmapWriteAccess.hxx>
@@ -1120,6 +1121,26 @@ PDFiumTextPage::~PDFiumTextPage()
int PDFiumTextPage::countChars() { return FPDFText_CountChars(mpTextPage); }
+basegfx::B2DRectangle PDFiumTextPage::getCharBox(int nIndex, double fPageHeight)
+{
+ double left = 0.0;
+ double right = 0.0;
+ double bottom = 0.0;
+ double top = 0.0;
+
+ if (FPDFText_GetCharBox(mpTextPage, nIndex, &left, &right, &bottom, &top))
+ {
+ left = convertPointToMm100(left);
+ right = convertPointToMm100(right);
+ top = fPageHeight - convertPointToMm100(top);
+ bottom = fPageHeight - convertPointToMm100(bottom);
+
+ return basegfx::B2DRectangle(left, bottom, right, top);
+ }
+
+ return basegfx::B2DRectangle();
+}
+
unsigned int PDFiumTextPage::getUnicode(int index)
{
return FPDFText_GetUnicode(mpTextPage, index);