summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-12-15 21:04:16 +0100
committerMiklos Vajna <vmiklos@collabora.com>2020-12-16 09:07:21 +0100
commit3962f6ba4761e2021c8d6b91487259bc16b98671 (patch)
tree21769c1e988de25257eb2028a8268005755832eb
parent97e2bd837841368e5c64d7c2fed0d423b0ad4606 (diff)
pdfium: rework to eliminate FPDF_PATHSEGMENT from the public interface
Change-Id: Ibb782d7fe835a001ef13a80afe2f7cf351eda081 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107793 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--include/vcl/filter/PDFiumLibrary.hxx18
-rw-r--r--vcl/source/pdf/PDFiumLibrary.cxx28
2 files changed, 26 insertions, 20 deletions
diff --git a/include/vcl/filter/PDFiumLibrary.hxx b/include/vcl/filter/PDFiumLibrary.hxx
index 2acdecac763b..cc6d65c15362 100644
--- a/include/vcl/filter/PDFiumLibrary.hxx
+++ b/include/vcl/filter/PDFiumLibrary.hxx
@@ -119,21 +119,13 @@ public:
class PDFiumTextPage;
-class VCL_DLLPUBLIC PDFiumPathSegment final
+class VCL_DLLPUBLIC PDFiumPathSegment
{
-private:
- FPDF_PATHSEGMENT mpPathSegment;
-
- PDFiumPathSegment(const PDFiumPathSegment&) = delete;
- PDFiumPathSegment& operator=(const PDFiumPathSegment&) = delete;
-
public:
- PDFiumPathSegment(FPDF_PATHSEGMENT pPathSegment);
- ~PDFiumPathSegment();
-
- basegfx::B2DPoint getPoint() const;
- bool isClosed() const;
- PDFSegmentType getType() const;
+ virtual ~PDFiumPathSegment() = default;
+ virtual basegfx::B2DPoint getPoint() const = 0;
+ virtual bool isClosed() const = 0;
+ virtual PDFSegmentType getType() const = 0;
};
class VCL_DLLPUBLIC PDFiumPageObject final
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index cf435ac419c8..01b1acf1bd1a 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -109,6 +109,22 @@ public:
int getHeight() override;
PDFBitmapType getFormat() override;
};
+
+class PDFiumPathSegmentImpl final : public PDFiumPathSegment
+{
+private:
+ FPDF_PATHSEGMENT mpPathSegment;
+
+ PDFiumPathSegmentImpl(const PDFiumPathSegmentImpl&) = delete;
+ PDFiumPathSegmentImpl& operator=(const PDFiumPathSegmentImpl&) = delete;
+
+public:
+ PDFiumPathSegmentImpl(FPDF_PATHSEGMENT pPathSegment);
+
+ basegfx::B2DPoint getPoint() const override;
+ bool isClosed() const override;
+ PDFSegmentType getType() const override;
+};
}
OUString convertPdfDateToISO8601(OUString const& rInput)
@@ -568,7 +584,7 @@ std::unique_ptr<PDFiumPathSegment> PDFiumPageObject::getPathSegment(int index)
FPDF_PATHSEGMENT pPathSegment = FPDFPath_GetPathSegment(mpPageObject, index);
if (pPathSegment)
{
- pPDFiumPathSegment = std::make_unique<PDFiumPathSegment>(pPathSegment);
+ pPDFiumPathSegment = std::make_unique<PDFiumPathSegmentImpl>(pPathSegment);
}
return pPDFiumPathSegment;
}
@@ -632,14 +648,12 @@ double PDFiumPage::getHeight() { return FPDF_GetPageHeight(mpPage); }
bool PDFiumPage::hasTransparency() { return FPDFPage_HasTransparency(mpPage); }
-PDFiumPathSegment::PDFiumPathSegment(FPDF_PATHSEGMENT pPathSegment)
+PDFiumPathSegmentImpl::PDFiumPathSegmentImpl(FPDF_PATHSEGMENT pPathSegment)
: mpPathSegment(pPathSegment)
{
}
-PDFiumPathSegment::~PDFiumPathSegment() {}
-
-basegfx::B2DPoint PDFiumPathSegment::getPoint() const
+basegfx::B2DPoint PDFiumPathSegmentImpl::getPoint() const
{
basegfx::B2DPoint aPoint;
float fx, fy;
@@ -648,9 +662,9 @@ basegfx::B2DPoint PDFiumPathSegment::getPoint() const
return aPoint;
}
-bool PDFiumPathSegment::isClosed() const { return FPDFPathSegment_GetClose(mpPathSegment); }
+bool PDFiumPathSegmentImpl::isClosed() const { return FPDFPathSegment_GetClose(mpPathSegment); }
-PDFSegmentType PDFiumPathSegment::getType() const
+PDFSegmentType PDFiumPathSegmentImpl::getType() const
{
return static_cast<PDFSegmentType>(FPDFPathSegment_GetType(mpPathSegment));
}