summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qt4/src/poppler-document.cc17
-rw-r--r--qt4/src/poppler-qt4.h10
-rw-r--r--qt5/src/poppler-document.cc17
-rw-r--r--qt5/src/poppler-qt5.h10
4 files changed, 52 insertions, 2 deletions
diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc
index de7e36d5..a1b0b118 100644
--- a/qt4/src/poppler-document.cc
+++ b/qt4/src/poppler-document.cc
@@ -7,6 +7,7 @@
* Copyright (C) 2012 Koji Otani <sho@bbr.jp>
* Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
* Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
+ * Copyright (C) 2014 Adam Reichold <adamreichold@myopera.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +33,7 @@
#include <PDFDoc.h>
#include <Stream.h>
#include <Catalog.h>
+#include <ViewerPreferences.h>
#include <DateInfo.h>
#include <GfxState.h>
@@ -193,6 +195,21 @@ namespace Poppler {
}
}
+ Qt::LayoutDirection Document::textDirection() const
+ {
+ if (!m_doc->doc->getCatalog()->getViewerPreferences())
+ return Qt::LayoutDirectionAuto;
+
+ switch (m_doc->doc->getCatalog()->getViewerPreferences()->getDirection()) {
+ case ViewerPreferences::directionL2R:
+ return Qt::LeftToRight;
+ case ViewerPreferences::directionR2L:
+ return Qt::RightToLeft;
+ default:
+ return Qt::LayoutDirectionAuto;
+ }
+ }
+
int Document::numPages() const
{
return m_doc->doc->getNumPages();
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 72874ec3..30295cf7 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -12,7 +12,7 @@
* Copyright (C) 2012, Guillermo A. Amaral B. <gamaral@kde.org>
* Copyright (C) 2012, Fabio D'Urso <fabiodurso@hotmail.it>
* Copyright (C) 2012, Tobias Koenig <tobias.koenig@kdab.com>
- * Copyright (C) 2012 Adam Reichold <adamreichold@myopera.com>
+ * Copyright (C) 2012, 2014 Adam Reichold <adamreichold@myopera.com>
* Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
*
* This program is free software; you can redistribute it and/or modify
@@ -990,6 +990,14 @@ delete it;
PageLayout pageLayout() const;
/**
+ The predominant reading order for text as supplied by
+ the document's viewer preferences.
+
+ \since 0.26
+ */
+ Qt::LayoutDirection textDirection() const;
+
+ /**
Provide the passwords required to unlock the document
\param ownerPassword the Latin1-encoded owner password to use in
diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc
index 158d506c..21f0633a 100644
--- a/qt5/src/poppler-document.cc
+++ b/qt5/src/poppler-document.cc
@@ -7,6 +7,7 @@
* Copyright (C) 2012 Koji Otani <sho@bbr.jp>
* Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
* Copyright (C) 2012 Fabio D'Urso <fabiodurso@hotmail.it>
+ * Copyright (C) 2014 Adam Reichold <adamreichold@myopera.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -32,6 +33,7 @@
#include <PDFDoc.h>
#include <Stream.h>
#include <Catalog.h>
+#include <ViewerPreferences.h>
#include <DateInfo.h>
#include <GfxState.h>
@@ -193,6 +195,21 @@ namespace Poppler {
}
}
+ Qt::LayoutDirection Document::textDirection() const
+ {
+ if (!m_doc->doc->getCatalog()->getViewerPreferences())
+ return Qt::LayoutDirectionAuto;
+
+ switch (m_doc->doc->getCatalog()->getViewerPreferences()->getDirection()) {
+ case ViewerPreferences::directionL2R:
+ return Qt::LeftToRight;
+ case ViewerPreferences::directionR2L:
+ return Qt::RightToLeft;
+ default:
+ return Qt::LayoutDirectionAuto;
+ }
+ }
+
int Document::numPages() const
{
return m_doc->doc->getNumPages();
diff --git a/qt5/src/poppler-qt5.h b/qt5/src/poppler-qt5.h
index 0eb0b44a..6f360888 100644
--- a/qt5/src/poppler-qt5.h
+++ b/qt5/src/poppler-qt5.h
@@ -12,7 +12,7 @@
* Copyright (C) 2012, Guillermo A. Amaral B. <gamaral@kde.org>
* Copyright (C) 2012, Fabio D'Urso <fabiodurso@hotmail.it>
* Copyright (C) 2012, Tobias Koenig <tobias.koenig@kdab.com>
- * Copyright (C) 2012 Adam Reichold <adamreichold@myopera.com>
+ * Copyright (C) 2012, 2014 Adam Reichold <adamreichold@myopera.com>
* Copyright (C) 2012, 2013 Thomas Freitag <Thomas.Freitag@alfa.de>
* Copyright (C) 2013 Anthony Granger <grangeranthony@gmail.com>
*
@@ -979,6 +979,14 @@ delete it;
PageLayout pageLayout() const;
/**
+ The predominant reading order for text as supplied by
+ the document's viewer preferences.
+
+ \since 0.26
+ */
+ Qt::LayoutDirection textDirection() const;
+
+ /**
Provide the passwords required to unlock the document
\param ownerPassword the Latin1-encoded owner password to use in