summaryrefslogtreecommitdiff
path: root/qt4
diff options
context:
space:
mode:
authorAdam Reichold <adamreichold@myopera.com>2014-03-04 23:40:59 +0100
committerAlbert Astals Cid <aacid@kde.org>2014-03-04 23:41:39 +0100
commitb346df59ef0775f5bd74a9f7379b5f430ccd7b79 (patch)
treec4832d1df848407f015a2b58a2e22d89f30577f3 /qt4
parent2fc38c1866243598e22be07f0177e7d9385542d5 (diff)
Qt: Expose document-supplied text direction
Diffstat (limited to 'qt4')
-rw-r--r--qt4/src/poppler-document.cc17
-rw-r--r--qt4/src/poppler-qt4.h10
2 files changed, 26 insertions, 1 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