summaryrefslogtreecommitdiffstats
path: root/src/pdf/qpdfdocument_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdf/qpdfdocument_p.h')
-rw-r--r--src/pdf/qpdfdocument_p.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/pdf/qpdfdocument_p.h b/src/pdf/qpdfdocument_p.h
index 973dc1d4a..d52aabe4b 100644
--- a/src/pdf/qpdfdocument_p.h
+++ b/src/pdf/qpdfdocument_p.h
@@ -81,6 +81,31 @@ public:
QPointF getCharPosition(FPDF_TEXTPAGE textPage, double pageHeight, int charIndex);
QRectF getCharBox(FPDF_TEXTPAGE textPage, double pageHeight, int charIndex);
+ // FPDF takes the rotation parameter as an int.
+ // This enum is mapping the int values defined in fpdfview.h:956.
+ // (not using enum class to ensure int convertability)
+ enum QFPDFRotation {
+ Normal = 0,
+ ClockWise90 = 1,
+ ClockWise180 = 2,
+ CounterClockWise90 = 3
+ };
+
+ static constexpr QFPDFRotation toFPDFRotation(QPdfDocumentRenderOptions::Rotation rotation)
+ {
+ switch (rotation) {
+ case QPdfDocumentRenderOptions::Rotation::None:
+ return QFPDFRotation::Normal;
+ case QPdfDocumentRenderOptions::Rotation::Clockwise90:
+ return QFPDFRotation::ClockWise90;
+ case QPdfDocumentRenderOptions::Rotation::Clockwise180:
+ return QFPDFRotation::ClockWise180;
+ case QPdfDocumentRenderOptions::Rotation::Clockwise270:
+ return QFPDFRotation::CounterClockWise90;
+ }
+ Q_UNREACHABLE();
+ }
+
struct TextPosition {
QPointF position;
qreal height = 0;