[poppler] Branch 'cpp-frontend' - 6 commits - CMakeLists.txt configure.ac cpp/CMakeLists.txt cpp/.gitignore cpp/Makefile.am cpp/poppler-document.cpp cpp/poppler-document.h cpp/poppler-document-private.h cpp/poppler-embedded-file.cpp cpp/poppler-embedded-file.h cpp/poppler-embedded-file-private.h cpp/poppler-font.cpp cpp/poppler-font.h cpp/poppler-global.cpp cpp/poppler-global.h cpp/poppler-page.cpp cpp/poppler-page.h cpp/poppler-page-private.h cpp/poppler-page-transition.cpp cpp/poppler-page-transition.h cpp/poppler-private.cpp cpp/poppler-private.h cpp/poppler-rectangle.h cpp/poppler-toc.cpp cpp/poppler-toc.h cpp/poppler-toc-private.h Makefile.am poppler-cpp.pc.cmake poppler-cpp.pc.in

Pino Toscano pino at kemper.freedesktop.org
Sun Dec 13 14:46:56 PST 2009


 CMakeLists.txt                      |    8 
 Makefile.am                         |   15 +
 configure.ac                        |   18 +-
 cpp/.gitignore                      |    6 
 cpp/CMakeLists.txt                  |   34 +++
 cpp/Makefile.am                     |   32 +++
 cpp/poppler-document-private.h      |   55 ++++++
 cpp/poppler-document.cpp            |  316 ++++++++++++++++++++++++++++++++++++
 cpp/poppler-document.h              |   92 ++++++++++
 cpp/poppler-embedded-file-private.h |   40 ++++
 cpp/poppler-embedded-file.cpp       |  116 +++++++++++++
 cpp/poppler-embedded-file.h         |   55 ++++++
 cpp/poppler-font.cpp                |  166 ++++++++++++++++++
 cpp/poppler-font.h                  |   91 ++++++++++
 cpp/poppler-global.cpp              |  162 ++++++++++++++++++
 cpp/poppler-global.h                |   86 +++++++++
 cpp/poppler-page-private.h          |   44 +++++
 cpp/poppler-page-transition.cpp     |   95 ++++++++++
 cpp/poppler-page-transition.h       |   82 +++++++++
 cpp/poppler-page.cpp                |  121 +++++++++++++
 cpp/poppler-page.h                  |   62 +++++++
 cpp/poppler-private.cpp             |   70 +++++++
 cpp/poppler-private.h               |   66 +++++++
 cpp/poppler-rectangle.h             |   60 ++++++
 cpp/poppler-toc-private.h           |   62 +++++++
 cpp/poppler-toc.cpp                 |  136 +++++++++++++++
 cpp/poppler-toc.h                   |   74 ++++++++
 poppler-cpp.pc.cmake                |    9 +
 poppler-cpp.pc.in                   |    9 +
 29 files changed, 2178 insertions(+), 4 deletions(-)

New commits:
commit 9d0cf201e96044dd679c26bea6255d986a6cd246
Author: Pino Toscano <pino at kde.org>
Date:   Sun Dec 13 23:45:39 2009 +0100

    [cpp] add ignore file

diff --git a/cpp/.gitignore b/cpp/.gitignore
new file mode 100644
index 0000000..62535c7
--- /dev/null
+++ b/cpp/.gitignore
@@ -0,0 +1,6 @@
+.deps
+.libs
+*.la
+*.lo
+Makefile
+Makefile.in
commit d783e92b863d8b22de6ca326328115fec63193ed
Author: Pino Toscano <pino at kde.org>
Date:   Sun Dec 13 23:42:33 2009 +0100

    [cpp] don't forget the cmake stuff when packing with the autotools

diff --git a/Makefile.am b/Makefile.am
index 59544e4..6d279ad 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,6 +56,7 @@ pkgconfig_DATA =				\
 
 # Add CMake buildsystem files here so they get added on make dist
 EXTRA_DIST +=							\
+	cpp/CMakeLists.txt					\
 	glib/demo/CMakeLists.txt				\
 	glib/CMakeLists.txt					\
 	glib/poppler-features.h.cmake				\
@@ -85,6 +86,7 @@ EXTRA_DIST +=							\
 	config.h.cmake						\
 	poppler-cairo.pc.cmake					\
 	poppler-config.h.cmake					\
+	poppler-cpp.pc.cmake					\
 	poppler-glib.pc.cmake					\
 	poppler-qt.pc.cmake					\
 	poppler-qt4.pc.cmake					\
commit 0105caefe860e7a45fc7d3a1bd1162fe56bcfe6a
Author: Pino Toscano <pino at kde.org>
Date:   Sun Dec 13 23:40:55 2009 +0100

    [cpp] add the pkg-config stuff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index f6cf57c..023229c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -452,6 +452,9 @@ endif(GLIB_FOUND)
 if(CAIRO_FOUND)
   poppler_create_install_pkgconfig(poppler-cairo.pc lib${LIB_SUFFIX}/pkgconfig)
 endif(CAIRO_FOUND)
+if(ENABLE_CPP)
+  poppler_create_install_pkgconfig(poppler-cpp.pc lib${LIB_SUFFIX}/pkgconfig)
+endif(ENABLE_CPP)
 
 
 message("Building Poppler with support for:")
diff --git a/Makefile.am b/Makefile.am
index 87209a6..59544e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,7 @@ endif
 
 if BUILD_POPPLER_CPP
 cpp_subdir = cpp
+cpp_pc_file = poppler-cpp.pc
 endif
 
 if BUILD_UTILS
@@ -40,7 +41,8 @@ EXTRA_DIST =					\
 	poppler.pc.in				\
 	poppler-cairo.pc.in			\
 	poppler-splash.pc.in			\
-	poppler-qt.pc.in
+	poppler-qt.pc.in			\
+	poppler-cpp.pc.in
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA =				\
@@ -49,7 +51,8 @@ pkgconfig_DATA =				\
 	$(splash_pc_file)			\
 	$(glib_pc_file)				\
 	$(qt_pc_file)                           \
-	$(qt4_pc_file)
+	$(qt4_pc_file)				\
+	$(cpp_pc_file)
 
 # Add CMake buildsystem files here so they get added on make dist
 EXTRA_DIST +=							\
diff --git a/configure.ac b/configure.ac
index 28d1b67..a7d61f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -571,7 +571,8 @@ poppler-cairo.pc
 poppler-splash.pc
 poppler-glib.pc
 poppler-qt.pc
-poppler-qt4.pc])
+poppler-qt4.pc
+poppler-cpp.pc])
 
 
 echo ""
diff --git a/poppler-cpp.pc.cmake b/poppler-cpp.pc.cmake
new file mode 100644
index 0000000..eeb11cc
--- /dev/null
+++ b/poppler-cpp.pc.cmake
@@ -0,0 +1,9 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib at LIB_SUFFIX@
+includedir=${prefix}/include
+
+Name: poppler-cpp
+Description: cpp backend for Poppler PDF rendering library
+Version: @POPPLER_VERSION@
+Requires: poppler = @POPPLER_VERSION@
diff --git a/poppler-cpp.pc.in b/poppler-cpp.pc.in
new file mode 100644
index 0000000..309f070
--- /dev/null
+++ b/poppler-cpp.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: poppler-cpp
+Description: cpp backend for Poppler PDF rendering library
+Version: @VERSION@
+Requires: poppler = @VERSION@
commit d5a74f78df0dca24fd537b30424fd2ebb3efe3e2
Author: Pino Toscano <pino at kde.org>
Date:   Sun Dec 13 23:35:06 2009 +0100

    [cpp] add the (rest of the) CMake build system for it

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ae5f8d6..f6cf57c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,7 @@ option(BUILD_QT3_TESTS "Whether compile the Qt3 test programs." ON)
 option(BUILD_QT4_TESTS "Whether compile the Qt4 test programs." ON)
 option(ENABLE_SPLASH "Build the Splash graphics backend." ON)
 option(ENABLE_UTILS "Compile poppler command line utils." ON)
+option(ENABLE_CPP "Compile poppler cpp wrapper." ON)
 option(ENABLE_ABIWORD "Build the Abiword backend." ON)
 option(ENABLE_LIBOPENJPEG "Use libopenjpeg for JPX streams." ON)
 option(ENABLE_LCMS "Use liblcms for color management." ON)
@@ -418,6 +419,9 @@ add_subdirectory(test)
 if(QT4_FOUND)
   add_subdirectory(qt4)
 endif(QT4_FOUND)
+if(ENABLE_CPP)
+  add_subdirectory(cpp)
+endif(ENABLE_CPP)
 
 set(PKG_CONFIG_VERSION_0_18 TRUE)
 if(PKGCONFIG_EXECUTABLE)
@@ -458,6 +462,7 @@ show_end_message("qt wrapper" QT3_FOUND)
 show_end_message("qt4 wrapper" QT4_FOUND)
 show_end_message("glib wrapper" GLIB_FOUND)
 # message("  use gtk-doc:        $enable_gtk_doc") # TODO
+show_end_message("cpp wrapper" ENABLE_CPP)
 show_end_message("use libjpeg" ENABLE_LIBJPEG)
 show_end_message("use libpng" ENABLE_LIBPNG)
 show_end_message("use zlib" ENABLE_ZLIB)
commit 0e41f937946e4e4c1b660406bd74e4afe8825b5f
Author: Pino Toscano <pino at kde.org>
Date:   Sun Dec 13 23:31:46 2009 +0100

    [cpp] add the autotools buildsystem for it

diff --git a/Makefile.am b/Makefile.am
index 2a75262..87209a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,11 +25,15 @@ qt4_subdir = qt4
 qt4_pc_file = poppler-qt4.pc
 endif
 
+if BUILD_POPPLER_CPP
+cpp_subdir = cpp
+endif
+
 if BUILD_UTILS
 utils_subdir = utils
 endif
 
-SUBDIRS = goo fofi $(splash_subdir) poppler $(utils_subdir) $(glib_subdir) $(qt_subdir) test $(qt4_subdir)
+SUBDIRS = goo fofi $(splash_subdir) poppler $(utils_subdir) $(glib_subdir) $(qt_subdir) test $(qt4_subdir) $(cpp_subdir)
 
 EXTRA_DIST =					\
 	README-XPDF				\
diff --git a/configure.ac b/configure.ac
index 7a8ca19..28d1b67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -444,6 +444,19 @@ fi
 
 AM_CONDITIONAL(BUILD_POPPLER_QT4, test "x$enable_poppler_qt4" = "xyes")
 
+dnl
+dnl CPP frontend
+dnl
+
+AC_ARG_ENABLE(poppler-cpp,
+              AC_HELP_STRING([--disable-poppler-cpp],
+                             [Don't compile poppler cpp wrapper.]),
+              enable_poppler_cpp=$enableval,
+              enable_poppler_cpp="yes")
+
+AM_CONDITIONAL(BUILD_POPPLER_CPP, test "x$enable_poppler_cpp" = "xyes")
+
+
 AC_ARG_ENABLE(gtk-test,
               AC_HELP_STRING([--disable-gtk-test],
 	                     [Don't compile GTK+ test program.]),
@@ -552,6 +565,7 @@ qt4/Makefile
 qt4/src/Makefile
 qt4/tests/Makefile
 qt4/demos/Makefile
+cpp/Makefile
 poppler.pc
 poppler-cairo.pc
 poppler-splash.pc
@@ -569,6 +583,7 @@ echo "  qt wrapper:         $enable_poppler_qt"
 echo "  qt4 wrapper:        $enable_poppler_qt4"
 echo "  glib wrapper:       $enable_poppler_glib"
 echo "    use GDK:          $enable_gdk"
+echo "  cpp wrapper:        $enable_poppler_cpp"
 echo "  use gtk-doc:        $enable_gtk_doc"
 echo "  use libjpeg:        $enable_libjpeg"
 echo "  use libpng:         $enable_libpng"
diff --git a/cpp/Makefile.am b/cpp/Makefile.am
new file mode 100644
index 0000000..58b8dd1
--- /dev/null
+++ b/cpp/Makefile.am
@@ -0,0 +1,32 @@
+INCLUDES =					\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/goo			\
+	-I$(top_srcdir)/poppler
+
+
+poppler_includedir = $(includedir)/poppler/cpp
+poppler_include_HEADERS =			\
+	poppler-document.h			\
+	poppler-embedded-file.h			\
+	poppler-font.h				\
+	poppler-global.h			\
+	poppler-page.h				\
+	poppler-page-transition.h		\
+	poppler-rectangle.h			\
+	poppler-toc.h
+
+lib_LTLIBRARIES = libpoppler-cpp.la
+libpoppler_cpp_la_SOURCES =			\
+	poppler-document.cpp			\
+	poppler-embedded-file.cpp		\
+	poppler-font.cpp			\
+	poppler-global.cpp			\
+	poppler-page.cpp			\
+	poppler-page-transition.cpp		\
+	poppler-private.cpp			\
+	poppler-toc.cpp
+
+libpoppler_cpp_la_LIBADD = 			\
+	$(top_builddir)/poppler/libpoppler.la
+
+libpoppler_cpp_la_LDFLAGS = -version-info 1:0:1 @create_shared_lib@
commit 9727fdc0c682742335e44ddc2f32d60e4c59983a
Author: Pino Toscano <pino at kde.org>
Date:   Sun Dec 13 22:55:28 2009 +0100

    Start of a pure C++ frontend for Poppler.
    
    This initial version (called 'poppler-cpp') includes preliminary support for:
    - document (loading from file name, some query methods, unlocking, font listing, embedded files)
    - page (some query methods) with page transitions
    - TOC
    
    Modelled a bit on the Qt4 API, it provides also an own "ustring" typedef representing UTF-16 strings,
    with methods to convert back/to UTF-8 and Latin 1.
    
    Most probably it has bugs, but nevertheless worth testing and developing.

diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
new file mode 100644
index 0000000..42fbca2
--- /dev/null
+++ b/cpp/CMakeLists.txt
@@ -0,0 +1,34 @@
+include_directories(
+  ${CMAKE_CURRENT_BINARY_DIR}
+)
+
+set(poppler_cpp_SRCS
+  poppler-document.cpp
+  poppler-embedded-file.cpp
+  poppler-font.cpp
+  poppler-global.cpp
+  poppler-page.cpp
+  poppler-page-transition.cpp
+  poppler-private.cpp
+  poppler-toc.cpp
+)
+
+add_library(poppler-cpp SHARED ${poppler_cpp_SRCS})
+set_target_properties(poppler-cpp PROPERTIES VERSION 0.1.0 SOVERSION 0)
+target_link_libraries(poppler-cpp poppler)
+if(MSVC)
+target_link_libraries(poppler-cpp ${poppler_LIBS})
+endif(MSVC)
+install(TARGETS poppler-cpp RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX})
+
+install(FILES
+  poppler-document.h
+  poppler-embedded-file.h
+  poppler-font.h
+  poppler-global.h
+  poppler-page.h
+  poppler-page-transition.h
+  poppler-rectangle.h
+  poppler-toc.h
+  DESTINATION include/poppler/cpp)
+
diff --git a/cpp/poppler-document-private.h b/cpp/poppler-document-private.h
new file mode 100644
index 0000000..52ed935
--- /dev/null
+++ b/cpp/poppler-document-private.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_DOCUMENT_PRIVATE_H
+#define POPPLER_DOCUMENT_PRIVATE_H
+
+#include "poppler-config.h"
+#include "GooString.h"
+#include "PDFDoc.h"
+
+#include <vector>
+
+namespace poppler
+{
+
+class document;
+class embedded_file;
+
+class document_private
+{
+public:
+    document_private(GooString *file_path, const std::string &owner_password,
+                     const std::string &user_password);
+    ~document_private();
+
+    static document* check_document(document_private *doc);
+
+    PDFDoc *doc;
+    bool is_locked;
+    std::vector<embedded_file *> embedded_files;
+
+private:
+    void init();
+
+    static unsigned int count;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-document.cpp b/cpp/poppler-document.cpp
new file mode 100644
index 0000000..46f52b9
--- /dev/null
+++ b/cpp/poppler-document.cpp
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-document.h"
+#include "poppler-embedded-file.h"
+#include "poppler-page.h"
+#include "poppler-toc.h"
+
+#include "poppler-document-private.h"
+#include "poppler-embedded-file-private.h"
+#include "poppler-private.h"
+#include "poppler-toc-private.h"
+
+#include "Catalog.h"
+#include "ErrorCodes.h"
+#include "GlobalParams.h"
+#include "Outline.h"
+
+#include <algorithm>
+#include <memory>
+
+using namespace poppler;
+
+unsigned int poppler::document_private::count = 0U;
+
+document_private::document_private(GooString *file_path, const std::string &owner_password,
+                                   const std::string &user_password)
+    : doc(0)
+    , is_locked(false)
+{
+    GooString goo_owner_password(owner_password.c_str());
+    GooString goo_user_password(user_password.c_str());
+    doc = new PDFDoc(file_path, &goo_owner_password, &goo_user_password);
+    init();
+}
+
+document_private::~document_private()
+{
+    delete_all(embedded_files);
+
+    delete doc;
+
+    if (count > 0) {
+        --count;
+        if (!count) {
+            delete globalParams;
+            globalParams = 0;
+        }
+    }
+}
+
+void document_private::init()
+{
+    if (!count) {
+        globalParams = new GlobalParams();
+        setErrorFunction(detail::error_function);
+    }
+    count++;
+}
+
+document* document_private::check_document(document_private *doc)
+{
+    if (doc->doc->isOk() || doc->doc->getErrorCode() == errEncrypted) {
+        if (doc->doc->getErrorCode() == errEncrypted) {
+            doc->is_locked = true;
+        }
+        return new document(*doc);
+    } else {
+        delete doc;
+    }
+    return 0;
+}
+
+
+document::document(document_private &dd)
+    : d(&dd)
+{
+}
+
+document::~document()
+{
+    delete d;
+}
+
+bool document::is_locked() const
+{
+    return d->is_locked;
+}
+
+bool document::unlock(const std::string &owner_password, const std::string &user_password)
+{
+    if (d->is_locked) {
+        document_private *newdoc = 0;
+        {
+            newdoc = new document_private(new GooString(d->doc->getFileName()),
+                                          owner_password, user_password);
+        }
+        if (!newdoc->doc->isOk()) {
+            delete newdoc;
+        } else {
+            delete d;
+            d = newdoc;
+            d->is_locked = false;
+        }
+    }
+    return d->is_locked;
+}
+
+document::page_mode_enum document::page_mode() const
+{
+    switch (d->doc->getCatalog()->getPageMode()) {
+    case Catalog::pageModeNone:
+        return use_none;
+    case Catalog::pageModeOutlines:
+        return use_outlines;
+    case Catalog::pageModeThumbs:
+        return use_thumbs;
+    case Catalog::pageModeFullScreen:
+        return fullscreen;
+    case Catalog::pageModeOC:
+        return use_oc;
+    case Catalog::pageModeAttach:
+        return use_attach;
+    default:
+        return use_none;
+    }
+}
+
+document::page_layout_enum document::page_layout() const
+{
+    switch (d->doc->getCatalog()->getPageLayout()) {
+    case Catalog::pageLayoutNone:
+        return no_layout;
+    case Catalog::pageLayoutSinglePage:
+        return single_page;
+    case Catalog::pageLayoutOneColumn:
+        return one_column;
+    case Catalog::pageLayoutTwoColumnLeft:
+        return two_column_left;
+    case Catalog::pageLayoutTwoColumnRight:
+        return two_column_right;
+    case Catalog::pageLayoutTwoPageLeft:
+        return two_page_left;
+    case Catalog::pageLayoutTwoPageRight:
+        return two_page_right;
+    default:
+        return no_layout;
+    }
+}
+
+void document::get_pdf_version(int *major, int *minor) const
+{
+    if (major) {
+        *major = d->doc->getPDFMajorVersion();
+    }
+    if (minor) {
+        *minor = d->doc->getPDFMinorVersion();
+    }
+}
+
+std::vector<std::string> document::info_keys() const
+{
+    if (d->is_locked) {
+        return std::vector<std::string>();
+    }
+
+    Object info;
+    if (!d->doc->getDocInfo(&info)->isDict()) {
+        info.free();
+        return std::vector<std::string>();
+    }
+
+    Dict *info_dict = info.getDict();
+    std::vector<std::string> keys(info_dict->getLength());
+    for (int i = 0; i < info_dict->getLength(); ++i) {
+        keys[i] = std::string(info_dict->getKey(i));
+    }
+
+    info.free();
+    return keys;
+}
+
+ustring document::info_key(const std::string &key) const
+{
+    if (d->is_locked) {
+        return ustring();
+    }
+
+    Object info;
+    if (!d->doc->getDocInfo(&info)->isDict()) {
+        info.free();
+        return ustring();
+    }
+
+    Dict *info_dict = info.getDict();
+    Object obj;
+    ustring result;
+    if (info_dict->lookup(PSTR(key.c_str()), &obj)->isString()) {
+        result = detail::unicode_GooString_to_ustring(obj.getString());
+    }
+    obj.free();
+    info.free();
+    return result;
+}
+
+unsigned int document::info_date(const std::string &key) const
+{
+    if (d->is_locked) {
+        return (unsigned int)(-1);
+    }
+
+    Object info;
+    if (!d->doc->getDocInfo(&info)->isDict()) {
+        info.free();
+        return (unsigned int)(-1);
+    }
+
+    Dict *info_dict = info.getDict();
+    Object obj;
+    unsigned int result = (unsigned int)(-1);
+    if (info_dict->lookup(PSTR(key.c_str()), &obj)->isString()) {
+        result = convert_date(obj.getString()->getCString());
+    }
+    obj.free();
+    info.free();
+    return result;
+}
+
+int document::pages() const
+{
+    return d->doc->getNumPages();
+}
+
+page* document::create_page(const ustring &label) const
+{
+    std::auto_ptr<GooString> goolabel(detail::ustring_to_unicode_GooString(label));
+    int index = 0;
+
+    if (!d->doc->getCatalog()->labelToIndex(goolabel.get(), &index)) {
+        return 0;
+    }
+    return create_page(index);
+}
+
+page* document::create_page(int index) const
+{
+    return index >= 0 && index < d->doc->getNumPages() ? new page(d, index) : 0;
+}
+
+std::vector<font_info> document::fonts() const
+{
+    std::vector<font_info> result;
+    font_iterator it(0, d);
+    while (it.has_next()) {
+        const std::vector<font_info> l = it.next();
+        std::copy(l.begin(), l.end(), std::back_inserter(result));
+    }
+    return result;
+}
+
+font_iterator* document::create_font_iterator(int start_page) const
+{
+    return new font_iterator(start_page, d);
+}
+
+toc* document::create_toc() const
+{
+    return toc_private::load_from_outline(d->doc->getOutline());
+}
+
+bool document::has_embedded_files() const
+{
+    return d->doc->getCatalog()->numEmbeddedFiles() > 0;
+}
+
+std::vector<embedded_file *> document::embedded_files() const
+{
+    if (d->is_locked) {
+        return std::vector<embedded_file *>();
+    }
+
+    if (d->embedded_files.empty() && d->doc->getCatalog()->numEmbeddedFiles() > 0) {
+        const int num = d->doc->getCatalog()->numEmbeddedFiles();
+        d->embedded_files.resize(num);
+        for (int i = 0; i < num; ++i) {
+            EmbFile *ef = d->doc->getCatalog()->embeddedFile(i);
+            d->embedded_files[i] = embedded_file_private::create(ef);
+        }
+    }
+    return d->embedded_files;
+}
+
+document* document::load_from_file(const std::string &file_name,
+                                   const std::string &owner_password,
+                                   const std::string &user_password)
+{
+    document_private *doc = new document_private(
+                                new GooString(file_name.c_str()),
+                                owner_password, user_password);
+    return document_private::check_document(doc);
+}
diff --git a/cpp/poppler-document.h b/cpp/poppler-document.h
new file mode 100644
index 0000000..7ff4337
--- /dev/null
+++ b/cpp/poppler-document.h
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_DOCUMENT_H
+#define POPPLER_DOCUMENT_H
+
+#include "poppler-global.h"
+#include "poppler-font.h"
+
+namespace poppler
+{
+
+class document_private;
+class embedded_file;
+class page;
+class toc;
+
+class POPPLER_CPP_EXPORT document : public poppler::noncopyable
+{
+public:
+    enum page_mode_enum {
+        use_none,
+        use_outlines,
+        use_thumbs,
+        fullscreen,
+        use_oc,
+        use_attach
+    };
+
+    enum page_layout_enum {
+        no_layout,
+        single_page,
+        one_column,
+        two_column_left,
+        two_column_right,
+        two_page_left,
+        two_page_right
+    };
+
+    ~document();
+
+    bool is_locked() const;
+    bool unlock(const std::string &owner_password, const std::string &user_password);
+
+    page_mode_enum page_mode() const;
+    page_layout_enum page_layout() const;
+    void get_pdf_version(int *major, int *minor) const;
+    std::vector<std::string> info_keys() const;
+    ustring info_key(const std::string &key) const;
+    unsigned int /*time_t*/ info_date(const std::string &key) const;
+
+    int pages() const;
+    page* create_page(const ustring &label) const;
+    page* create_page(int index) const;
+
+    std::vector<font_info> fonts() const;
+    font_iterator* create_font_iterator(int start_page = 0) const;
+
+    toc* create_toc() const;
+
+    bool has_embedded_files() const;
+    std::vector<embedded_file *> embedded_files() const;
+
+    static document* load_from_file(const std::string &file_name,
+                                    const std::string &owner_password,
+                                    const std::string &user_password);
+
+private:
+    document(document_private &dd);
+
+    document_private *d;
+    friend class document_private;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-embedded-file-private.h b/cpp/poppler-embedded-file-private.h
new file mode 100644
index 0000000..2acea65
--- /dev/null
+++ b/cpp/poppler-embedded-file-private.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_EMBEDDED_FILE_PRIVATE_H
+#define POPPLER_EMBEDDED_FILE_PRIVATE_H
+
+class EmbFile;
+
+namespace poppler
+{
+
+class embedded_file_private
+{
+public:
+    embedded_file_private(EmbFile *ef);
+    ~embedded_file_private();
+
+    static embedded_file* create(EmbFile *ef);
+
+    EmbFile *emb_file;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-embedded-file.cpp b/cpp/poppler-embedded-file.cpp
new file mode 100644
index 0000000..487b32d
--- /dev/null
+++ b/cpp/poppler-embedded-file.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-embedded-file.h"
+
+#include "poppler-embedded-file-private.h"
+#include "poppler-private.h"
+
+#include "Object.h"
+#include "Stream.h"
+#include "Catalog.h"
+
+using namespace poppler;
+
+embedded_file_private::embedded_file_private(EmbFile *ef)
+    : emb_file(ef)
+{
+}
+
+embedded_file_private::~embedded_file_private()
+{
+    delete emb_file;
+}
+
+embedded_file* embedded_file_private::create(EmbFile *ef)
+{
+    return new embedded_file(*new embedded_file_private(ef));
+}
+
+
+embedded_file::embedded_file(embedded_file_private &dd)
+    : d(&dd)
+{
+}
+
+embedded_file::~embedded_file()
+{
+    delete d;
+}
+
+bool embedded_file::is_valid() const
+{
+    return d->emb_file->isOk();
+}
+
+std::string embedded_file::name() const
+{
+    return std::string(d->emb_file->name()->getCString());
+}
+
+ustring embedded_file::description() const
+{
+    return detail::unicode_GooString_to_ustring(d->emb_file->description());
+}
+
+int embedded_file::size() const
+{
+    return d->emb_file->size();
+}
+
+unsigned int embedded_file::modification_date() const
+{
+    return convert_date(d->emb_file->modDate()->getCString());
+}
+
+unsigned int embedded_file::creation_date() const
+{
+    return convert_date(d->emb_file->createDate()->getCString());
+}
+
+std::string embedded_file::checksum() const
+{
+    return std::string(d->emb_file->checksum()->getCString());
+}
+
+std::string embedded_file::mime_type() const
+{
+    return std::string(d->emb_file->mimeType()->getCString());
+}
+
+std::vector<char> embedded_file::data() const
+{
+    if (!is_valid()) {
+        return std::vector<char>();
+    }
+
+    Stream *stream = d->emb_file->streamObject().getStream();
+    stream->reset();
+    std::vector<char> ret(1024);
+    size_t data_len = 0;
+    int i;
+    while ((i = stream->getChar()) != EOF) {
+        if (data_len == ret.size()) {
+            ret.resize(ret.size() * 2);
+        }
+        ret[data_len] = (char)i;
+        ++data_len;
+    }
+    ret.resize(data_len);
+    return ret;
+}
diff --git a/cpp/poppler-embedded-file.h b/cpp/poppler-embedded-file.h
new file mode 100644
index 0000000..250b84a
--- /dev/null
+++ b/cpp/poppler-embedded-file.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_EMBEDDED_FILE_H
+#define POPPLER_EMBEDDED_FILE_H
+
+#include "poppler-global.h"
+
+#include <vector>
+
+namespace poppler
+{
+
+class embedded_file_private;
+
+class POPPLER_CPP_EXPORT embedded_file : public poppler::noncopyable
+{
+public:
+    ~embedded_file();
+
+    bool is_valid() const;
+    std::string name() const;
+    ustring description() const;
+    int size() const;
+    unsigned int /*time_t*/ modification_date() const;
+    unsigned int /*time_t*/ creation_date() const;
+    std::string checksum() const;
+    std::string mime_type() const;
+    std::vector<char> data() const;
+
+private:
+    embedded_file(embedded_file_private &dd);
+
+    embedded_file_private *d;
+    friend class embedded_file_private;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-font.cpp b/cpp/poppler-font.cpp
new file mode 100644
index 0000000..5c3221b
--- /dev/null
+++ b/cpp/poppler-font.cpp
@@ -0,0 +1,166 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-font.h"
+
+#include "poppler-document-private.h"
+
+#include "FontInfo.h"
+
+using namespace poppler;
+
+class poppler::font_info_private
+{
+public:
+    font_info_private()
+        : type(font_info::unknown)
+        , is_embedded(false)
+        , is_subset(false)
+    {
+    }
+    font_info_private(FontInfo *fi)
+        : type((font_info::type_enum)fi->getType())
+        , is_embedded(fi->getEmbedded())
+        , is_subset(fi->getSubset())
+        , emb_ref(fi->getEmbRef())
+    {
+        if (fi->getName()) {
+            font_name = fi->getName()->getCString();
+        }
+        if (fi->getFile()) {
+            font_file = fi->getFile()->getCString();
+        }
+    }
+
+    std::string font_name;
+    std::string font_file;
+    font_info::type_enum type : 5;
+    bool is_embedded : 1;
+    bool is_subset : 1;
+    Ref emb_ref;
+};
+
+
+class poppler::font_iterator_private
+{
+public:
+    font_iterator_private(int start_page, document_private *dd)
+        : font_info_scanner(dd->doc, start_page)
+        , total_pages(dd->doc->getNumPages())
+        , current_page((std::max)(start_page, 0) - 1)
+    {
+    }
+    ~font_iterator_private()
+    {
+    }
+
+    FontInfoScanner font_info_scanner;
+    int total_pages;
+    int current_page;
+};
+
+
+font_info::font_info()
+    : d(new font_info_private())
+{
+}
+
+font_info::font_info(font_info_private &dd)
+    : d(&dd)
+{
+}
+
+font_info::font_info(const font_info &fi)
+    : d(new font_info_private(*fi.d))
+{
+}
+
+font_info::~font_info()
+{
+    delete d;
+}
+
+std::string font_info::name() const
+{
+    return d->font_name;
+}
+
+std::string font_info::file() const
+{
+    return d->font_file;
+}
+
+bool font_info::is_embedded() const
+{
+    return d->is_embedded;
+}
+
+bool font_info::is_subset() const
+{
+    return d->is_subset;
+}
+
+font_info::type_enum font_info::type() const
+{
+    return d->type;
+}
+
+font_info& font_info::operator=(const font_info &fi)
+{
+    if (this != &fi) {
+        *d = *fi.d;
+    }
+    return *this;
+}
+
+
+font_iterator::font_iterator(int start_page, document_private *dd)
+    : d(new font_iterator_private(start_page, dd))
+{
+}
+
+font_iterator::~font_iterator()
+{
+    delete d;
+}
+
+std::vector<font_info> font_iterator::next()
+{
+    ++d->current_page;
+
+    GooList *items = d->font_info_scanner.scan(1);
+    if (!items) {
+        return std::vector<font_info>();
+    }
+    std::vector<font_info> fonts(items->getLength());
+    for (int i = 0; i < items->getLength(); ++i) {
+        fonts[i] = font_info(*new font_info_private((FontInfo *)items->get(i)));
+    }
+    deleteGooList(items, FontInfo);
+    return fonts;
+}
+
+bool font_iterator::has_next() const
+{
+    return (d->current_page + 1) < d->total_pages;
+}
+
+int font_iterator::current_page() const
+{
+    return d->current_page;
+}
diff --git a/cpp/poppler-font.h b/cpp/poppler-font.h
new file mode 100644
index 0000000..854b7a4
--- /dev/null
+++ b/cpp/poppler-font.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_FONT_H
+#define POPPLER_FONT_H
+
+#include "poppler-global.h"
+
+#include <vector>
+
+namespace poppler
+{
+
+class document;
+class document_private;
+class font_info_private;
+class font_iterator;
+class font_iterator_private;
+
+class POPPLER_CPP_EXPORT font_info
+{
+public:
+    enum type_enum {
+        unknown,
+        type1,
+        type1c,
+        type1c_ot,
+        type3,
+        truetype,
+        truetype_ot,
+        cid_type0,
+        cid_type0c,
+        cid_type0c_ot,
+        cid_truetype,
+        cid_truetype_ot
+    };
+
+    font_info();
+    font_info(const font_info &fi);
+    ~font_info();
+
+    std::string name() const;
+    std::string file() const;
+    bool is_embedded() const;
+    bool is_subset() const;
+    type_enum type() const;
+
+    font_info& operator=(const font_info &fi);
+
+private:
+    font_info(font_info_private &dd);
+
+    font_info_private *d;
+    friend class font_iterator;
+};
+
+
+class POPPLER_CPP_EXPORT font_iterator : public poppler::noncopyable
+{
+public:
+    ~font_iterator();
+
+    std::vector<font_info> next();
+    bool has_next() const;
+    int current_page() const;
+
+private:
+    font_iterator(int, document_private *dd);
+
+    font_iterator_private *d;
+    friend class document;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-global.cpp b/cpp/poppler-global.cpp
new file mode 100644
index 0000000..ce27061
--- /dev/null
+++ b/cpp/poppler-global.cpp
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-global.h"
+
+#include "DateInfo.h"
+
+#include <ctime>
+#include <cstring>
+
+using namespace poppler;
+
+noncopyable::noncopyable()
+{
+}
+
+noncopyable::~noncopyable()
+{
+}
+
+
+ustring::ustring()
+{
+}
+
+ustring::ustring(size_type len, value_type ch)
+    : std::basic_string<value_type>(len, ch)
+{
+}
+
+ustring::~ustring()
+{
+}
+
+char* ustring::to_utf_8(int *length) const
+{
+    if (!size()) {
+        if (length) {
+            *length = 0;
+        }
+        return 0;
+    }
+
+    const value_type *me = data();
+    const size_t len = size() * 2 + 2;
+    char *str = new char[len];
+    str[0] = 0xfe;
+    str[1] = 0xff;
+    for (size_t i = 0; i < size(); ++i, ++me) {
+        str[i * 2 + 2] = (*me & 0xff);
+        str[i * 2 + 3] = ((*me >> 8) & 0xff);
+    }
+    if (length) {
+        *length = len;
+    }
+    return str;
+}
+
+std::string ustring::to_latin1() const
+{
+    if (!size()) {
+        return std::string();
+    }
+
+    const size_type mylength = size();
+    std::string ret(mylength, '\0');
+    const value_type *me = data();
+    for (size_type i = 0; i < mylength; ++i) {
+        ret[i] = (char)*me++;
+    }
+    return ret;
+}
+
+ustring ustring::from_utf_8(const char *str, int len)
+{
+    if (len <= 0) {
+        len = std::strlen(str);
+        if (len <= 0) {
+            return ustring();
+        }
+    }
+
+    int i = 0;
+    bool is_unicode = false;
+    if ((str[0] & 0xff) == 0xfe && (len > 1 && (str[1] & 0xff) == 0xff)) {
+        is_unicode = true;
+        i = 2;
+    }
+
+    const ustring::size_type ret_len = (len - i) / (is_unicode ? 2 : 1);
+    ustring ret(ret_len, 0);
+    size_t ret_index = 0;
+    ustring::value_type u;
+    if (is_unicode) {
+        while (i < len) {
+            u = ((str[i] & 0xff) << 8) | (str[i + 1] & 0xff);
+            i += 2;
+            ret[ret_index++] = u;
+        }
+    } else {
+        while (i < len) {
+            u = str[i] & 0xff;
+            ++i;
+            ret[ret_index++] = u;
+        }
+    }
+
+    return ret;
+}
+
+ustring ustring::from_latin1(const std::string &str)
+{
+    const size_type l = str.size();
+    if (!l) {
+        return ustring();
+    }
+    const char *c = str.data();
+    ustring ret(l, 0);
+    for (size_type i = 0; i < l; ++i) {
+        ret[i] = *c++;
+    }
+    return ret;
+}
+
+
+unsigned int convert_date(const std::string &date)
+{
+    int year, mon, day, hour, min, sec, tzHours, tzMins;
+    char tz;
+
+    if (!parseDateString(date.c_str(), &year, &mon, &day, &hour, &min, &sec,
+                                       &tz, &tzHours, &tzMins)) {
+        return (unsigned int)(-1);
+    }
+
+    struct tm time;
+    time.tm_sec = sec;
+    time.tm_min = min;
+    time.tm_hour = hour;
+    time.tm_mday = day;
+    time.tm_mon = mon - 1;
+    time.tm_year = year - 1900;
+    time.tm_wday = -1;
+    time.tm_yday = -1;
+    time.tm_isdst = -1;
+    return mktime(&time);
+}
diff --git a/cpp/poppler-global.h b/cpp/poppler-global.h
new file mode 100644
index 0000000..e51878c
--- /dev/null
+++ b/cpp/poppler-global.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_GLOBAL_H
+#define POPPLER_GLOBAL_H
+
+#if defined(_WIN32)
+#  define LIB_EXPORT __declspec(dllexport)
+#  define LIB_IMPORT __declspec(dllimport)
+#else
+#  define LIB_EXPORT
+#  define LIB_IMPORT
+#endif
+
+#if defined(poppler_cpp_EXPORTS)
+#  define POPPLER_CPP_EXPORT LIB_EXPORT
+#else
+#  define POPPLER_CPP_EXPORT LIB_IMPORT
+#endif
+
+#include <string>
+
+namespace poppler
+{
+
+namespace detail
+{
+
+class POPPLER_CPP_EXPORT noncopyable
+{
+protected:
+    noncopyable();
+    ~noncopyable();
+private:
+    noncopyable(const noncopyable &);
+    const noncopyable& operator=(const noncopyable &);
+};
+
+}
+
+typedef detail::noncopyable noncopyable;
+
+enum rotation_enum { rotate_0, rotate_90, rotate_180, rotate_270 };
+
+enum page_box_enum { media_box, crop_box, bleed_box, trim_box, art_box };
+
+class POPPLER_CPP_EXPORT ustring : public std::basic_string<unsigned short>
+{
+public:
+    ustring();
+    ustring(size_type len, value_type ch);
+    ~ustring();
+
+    char* to_utf_8(int *length = 0) const;
+    std::string to_latin1() const;
+
+    static ustring from_utf_8(const char *str, int len = -1);
+    static ustring from_latin1(const std::string &str);
+
+private:
+    // forbid implicit std::string conversions
+    ustring(const std::string &);
+    operator std::string() const;
+    ustring& operator=(const std::string &);
+};
+
+POPPLER_CPP_EXPORT unsigned int /*time_t*/ convert_date(const std::string &date);
+
+}
+
+#endif
diff --git a/cpp/poppler-page-private.h b/cpp/poppler-page-private.h
new file mode 100644
index 0000000..654478b
--- /dev/null
+++ b/cpp/poppler-page-private.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_PAGE_PRIVATE_H
+#define POPPLER_PAGE_PRIVATE_H
+
+class Page;
+
+namespace poppler
+{
+
+class document_private;
+class page_transition;
+
+class page_private
+{
+public:
+    page_private(document_private *doc, int index);
+    ~page_private();
+
+    document_private *doc;
+    Page *page;
+    int index;
+    page_transition *transition;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-page-transition.cpp b/cpp/poppler-page-transition.cpp
new file mode 100644
index 0000000..92ae4fc
--- /dev/null
+++ b/cpp/poppler-page-transition.cpp
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-page-transition.h"
+
+#include "PageTransition.h"
+
+using namespace poppler;
+
+class poppler::page_transition_private
+{
+public:
+    page_transition_private(Object *trans)
+        : pt(trans)
+    {
+    }
+
+    PageTransition pt;
+};
+
+
+page_transition::page_transition(Object *params)
+    : d(new page_transition_private(params))
+{
+}
+
+page_transition::page_transition(const page_transition &pt)
+    : d(new page_transition_private(*pt.d))
+{
+}
+
+page_transition::~page_transition()
+{
+    delete d;
+}
+
+page_transition::type_enum page_transition::type() const
+{
+    return (page_transition::type_enum)d->pt.getType();
+}
+
+int page_transition::duration() const
+{
+    return d->pt.getDuration();
+}
+
+page_transition::alignment_enum page_transition::alignment() const
+{
+    return (page_transition::alignment_enum)d->pt.getAlignment();
+}
+
+page_transition::direction_enum page_transition::direction() const
+{
+    return (page_transition::direction_enum)d->pt.getDirection();
+}
+
+int page_transition::angle() const
+{
+    return d->pt.getAngle();
+}
+
+double page_transition::scale() const
+{
+    return d->pt.getScale();
+}
+
+bool page_transition::is_rectangular() const
+{
+    return d->pt.isRectangular();
+}
+
+page_transition& page_transition::operator=(const page_transition &pt)
+{
+    if (&pt != this) {
+        page_transition_private *new_d = new page_transition_private(*pt.d);
+        delete d;
+        new_d = d;
+    }
+    return *this;
+}
diff --git a/cpp/poppler-page-transition.h b/cpp/poppler-page-transition.h
new file mode 100644
index 0000000..4ecb179
--- /dev/null
+++ b/cpp/poppler-page-transition.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_PAGE_TRANSITION_H
+#define POPPLER_PAGE_TRANSITION_H
+
+#include "poppler-global.h"
+
+class Object;
+
+namespace poppler
+{
+
+class page;
+class page_transition_private;
+
+class POPPLER_CPP_EXPORT page_transition
+{
+public:
+    enum type_enum {
+        replace = 0,
+        split,
+        blinds,
+        box,
+        wipe,
+        dissolve,
+        glitter,
+        fly,
+        push,
+        cover,
+        uncover,
+        fade
+    };
+
+    enum alignment_enum {
+        horizontal = 0,
+        vertical
+    };
+
+    enum direction_enum {
+        inward = 0,
+        outward
+    };
+
+    page_transition(const page_transition &pt);
+    ~page_transition();
+
+    type_enum type() const;
+    int duration() const;
+    alignment_enum alignment() const;
+    direction_enum direction() const;
+    int angle() const;
+    double scale() const;
+    bool is_rectangular() const;
+
+    page_transition& operator=(const page_transition &pt);
+
+private:
+    page_transition(Object *params);
+
+    page_transition_private *d;
+    friend class page;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-page.cpp b/cpp/poppler-page.cpp
new file mode 100644
index 0000000..b10cc5b
--- /dev/null
+++ b/cpp/poppler-page.cpp
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-page.h"
+#include "poppler-page-transition.h"
+
+#include "poppler-document-private.h"
+#include "poppler-page-private.h"
+#include "poppler-private.h"
+
+using namespace poppler;
+
+page_private::page_private(document_private *_doc, int _index)
+    : doc(_doc)
+    , page(doc->doc->getCatalog()->getPage(index + 1))
+    , index(_index)
+    , transition(0)
+{
+}
+
+page_private::~page_private()
+{
+    delete transition;
+}
+
+
+page::page(document_private *doc, int index)
+    : d(new page_private(doc, index))
+{
+}
+
+page::~page()
+{
+    delete d;
+}
+
+page::orientation_enum page::orientation() const
+{
+    const int rotation = d->page->getRotate();
+    switch (rotation) {
+    case 90:
+        return landscape;
+        break;
+    case 180:
+        return upside_down;
+        break;
+    case 270:
+        return seascape;
+        break;
+    default:
+        return portrait;
+    }
+}
+
+double page::duration() const
+{
+    return d->page->getDuration();
+}
+
+rectf page::page_rect(page_box_enum box) const
+{
+    PDFRectangle *r = 0;
+    switch (box) {
+    case media_box:
+        r = d->page->getMediaBox();
+        break;
+    case crop_box:
+        r = d->page->getCropBox();
+        break;
+    case bleed_box:
+        r = d->page->getBleedBox();
+        break;
+    case trim_box:
+        r = d->page->getTrimBox();
+        break;
+    case art_box:
+        r = d->page->getArtBox();
+        break;
+    }
+    if (r) {
+        return detail::pdfrectangle_to_rectf(*r);
+    }
+    return rectf();
+}
+
+ustring page::label() const
+{
+    GooString goo;
+    if (!d->doc->doc->getCatalog()->indexToLabel(d->index, &goo)) {
+        return ustring();
+    }
+
+    return detail::unicode_GooString_to_ustring(&goo);
+}
+
+page_transition* page::transition() const
+{
+    if (!d->transition) {
+        Object o;
+        if (d->page->getTrans(&o)->isDict()) {
+            d->transition = new page_transition(&o);
+        }
+        o.free();
+    }
+    return d->transition;
+}
diff --git a/cpp/poppler-page.h b/cpp/poppler-page.h
new file mode 100644
index 0000000..65cea52
--- /dev/null
+++ b/cpp/poppler-page.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_PAGE_H
+#define POPPLER_PAGE_H
+
+#include "poppler-global.h"
+#include "poppler-rectangle.h"
+
+namespace poppler
+{
+
+class document;
+class document_private;
+class page_private;
+class page_transition;
+
+class POPPLER_CPP_EXPORT page : public poppler::noncopyable
+{
+public:
+    enum orientation_enum {
+        landscape,
+        portrait,
+        seascape,
+        upside_down
+    };
+
+    ~page();
+
+    orientation_enum orientation() const;
+    double duration() const;
+    rectf page_rect(page_box_enum box = crop_box) const;
+    ustring label() const;
+
+    page_transition* transition() const;
+
+private:
+    page(document_private *doc, int index);
+
+    page_private *d;
+    friend class page_private;
+    friend class document;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-private.cpp b/cpp/poppler-private.cpp
new file mode 100644
index 0000000..16ba370
--- /dev/null
+++ b/cpp/poppler-private.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-private.h"
+
+#include "GooString.h"
+#include "Page.h"
+
+#include <iostream>
+#include <sstream>
+
+using namespace poppler;
+
+void detail::error_function(int pos, char *msg, va_list args)
+{
+    std::ostringstream oss;
+    if (pos >= 0) {
+        oss << "poppler/error (" << pos << "): ";
+    } else {
+        oss << "poppler/error: ";
+    }
+    char buffer[4096]; // should be big enough
+    vsnprintf(buffer, sizeof(buffer) - 1, msg, args);
+    oss << buffer;
+    std::cerr << oss.str();
+}
+
+rectf detail::pdfrectangle_to_rectf(const PDFRectangle &pdfrect)
+{
+    return rectf(pdfrect.x1, pdfrect.y1, pdfrect.x2 - pdfrect.x1, pdfrect.y2 - pdfrect.y1);
+}
+
+ustring detail::unicode_GooString_to_ustring(GooString *str)
+{
+    return ustring::from_utf_8(str->getCString(), str->getLength());
+}
+
+ustring detail::unicode_to_ustring(const Unicode *u, int length)
+{
+    ustring str(length, 0);
+    ustring::iterator it = str.begin(), it_end = str.end();
+    const Unicode *uu = u;
+    for (; it != it_end; ++it) {
+        *it = ustring::value_type(*uu++);
+    }
+    return str;
+}
+
+GooString* detail::ustring_to_unicode_GooString(const ustring &str)
+{
+    char *u = str.to_utf_8();
+    GooString *goo = new GooString(u);
+    delete [] u;
+    return goo;
+}
diff --git a/cpp/poppler-private.h b/cpp/poppler-private.h
new file mode 100644
index 0000000..fb3bc6c
--- /dev/null
+++ b/cpp/poppler-private.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_PRIVATE_H
+#define POPPLER_PRIVATE_H
+
+#include "poppler-global.h"
+#include "poppler-rectangle.h"
+
+#include "CharTypes.h"
+
+#include <stdarg.h>
+
+class GooString;
+class PDFRectangle;
+
+#define PSTR(str) const_cast<char *>(str)
+
+namespace poppler
+{
+
+namespace detail
+{
+
+void error_function(int pos, char *msg, va_list args);
+
+rectf pdfrectangle_to_rectf(const PDFRectangle &pdfrect);
+
+ustring unicode_GooString_to_ustring(GooString *str);
+ustring unicode_to_ustring(const Unicode *u, int length);
+GooString* ustring_to_unicode_GooString(const ustring &str);
+
+}
+
+template <typename ConstIterator>
+void delete_all(ConstIterator it, ConstIterator end)
+{
+    while (it != end) {
+        delete *it++;
+    }
+}
+
+template <typename Collection>
+void delete_all(const Collection &c)
+{
+    delete_all(c.begin(), c.end());
+}
+
+}
+
+#endif
diff --git a/cpp/poppler-rectangle.h b/cpp/poppler-rectangle.h
new file mode 100644
index 0000000..7465edc
--- /dev/null
+++ b/cpp/poppler-rectangle.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_RECTANGLE_H
+#define POPPLER_RECTANGLE_H
+
+namespace poppler
+{
+
+template <typename T> class rectangle
+{
+public:
+    rectangle()
+        : x1(), y1(), x2(), y2()
+    {}
+    rectangle(T _x, T _y, T w, T h)
+        : x1(_x), y1(_y), x2(x1 + w), y2(y1 + h)
+    {}
+    ~rectangle();
+
+    bool is_empty() const
+    { return (x1 == x2) && (y1 == y2); }
+
+    T x() const
+    { return x1; }
+
+    T y() const
+    { return y1; }
+
+    T width() const
+    { return x2 - x1; }
+
+    T height() const
+    { return y2 - y1; }
+
+private:
+    T x1, y1, x2, y2;
+};
+
+typedef rectangle<int> rect;
+typedef rectangle<double> rectf;
+
+}
+
+#endif
diff --git a/cpp/poppler-toc-private.h b/cpp/poppler-toc-private.h
new file mode 100644
index 0000000..e8841ff
--- /dev/null
+++ b/cpp/poppler-toc-private.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_TOC_PRIVATE_H
+#define POPPLER_TOC_PRIVATE_H
+
+#include "poppler-global.h"
+#include "poppler-toc.h"
+
+#include <vector>
+
+class GooList;
+class Outline;
+class OutlineItem;
+
+namespace poppler
+{
+
+class toc_private
+{
+public:
+    toc_private();
+    ~toc_private();
+
+    static toc* load_from_outline(Outline *outline);
+
+    toc_item root;
+};
+
+
+class toc_item_private
+{
+public:
+    toc_item_private();
+    ~toc_item_private();
+
+    void load(OutlineItem *item);
+    void load_children(GooList *items);
+
+    std::vector<toc_item*> children;
+    ustring title;
+    bool is_open;
+};
+
+}
+
+#endif
diff --git a/cpp/poppler-toc.cpp b/cpp/poppler-toc.cpp
new file mode 100644
index 0000000..6f05f21
--- /dev/null
+++ b/cpp/poppler-toc.cpp
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "poppler-toc.h"
+
+#include "poppler-toc-private.h"
+#include "poppler-private.h"
+
+#include "GooList.h"
+#include "Outline.h"
+
+using namespace poppler;
+
+toc_private::toc_private()
+{
+}
+
+toc_private::~toc_private()
+{
+}
+
+toc* toc_private::load_from_outline(Outline *outline)
+{
+    if (!outline) {
+        return 0;
+    }
+
+    GooList *items = outline->getItems();
+    if (!items || items->getLength() < 1) {
+        return 0;
+    }
+
+    toc *newtoc = new toc();
+    newtoc->d->root.d->is_open = true;
+    newtoc->d->root.d->load_children(outline->getItems());
+
+    return newtoc;
+}
+
+toc_item_private::toc_item_private()
+    : is_open(false)
+{
+}
+
+toc_item_private::~toc_item_private()
+{
+}
+
+void toc_item_private::load(OutlineItem *item)
+{
+    const Unicode *title_unicode = item->getTitle();
+    const int title_length = item->getTitleLength();
+    title = detail::unicode_to_ustring(title_unicode, title_length);
+    is_open = item->isOpen();
+}
+
+void toc_item_private::load_children(GooList *items)
+{
+    const int num_items = items->getLength();
+    children.resize(num_items);
+    for (int i = 0; i < num_items; ++i) {
+        OutlineItem *item = (OutlineItem *)items->get(i);
+
+        toc_item *new_item = new toc_item();
+        new_item->d->load(item);
+        children[i] = new_item;
+
+        item->open();
+        GooList *item_children = item->getKids();
+        if (item_children) {
+            new_item->d->load_children(item_children);
+        }
+    }
+}
+
+
+toc::toc()
+    : d(new toc_private())
+{
+}
+
+toc::~toc()
+{
+    delete d;
+}
+
+
+toc_item::toc_item()
+    : d(new toc_item_private())
+{
+}
+
+toc_item::~toc_item()
+{
+    delete d;
+}
+
+ustring toc_item::title() const
+{
+    return d->title;
+}
+
+bool toc_item::is_open() const
+{
+    return d->is_open;
+}
+
+std::vector<toc_item *> toc_item::children() const
+{
+    return d->children;
+}
+
+toc_item::iterator toc_item::children_begin() const
+{
+    return d->children.begin();
+}
+
+toc_item::iterator toc_item::children_end() const
+{
+    return d->children.end();
+}
diff --git a/cpp/poppler-toc.h b/cpp/poppler-toc.h
new file mode 100644
index 0000000..8b09736
--- /dev/null
+++ b/cpp/poppler-toc.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2009, Pino Toscano <pino at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef POPPLER_TOC_H
+#define POPPLER_TOC_H
+
+#include "poppler-global.h"
+
+#include <vector>
+
+namespace poppler
+{
+
+class toc_private;
+class toc_item;
+class toc_item_private;
+
+class POPPLER_CPP_EXPORT toc : public poppler::noncopyable
+{
+public:
+    ~toc();
+
+    toc_item* root() const;
+
+private:
+    toc();
+
+    toc_private *d;
+
+    friend class toc_private;
+};
+
+
+class POPPLER_CPP_EXPORT toc_item : public poppler::noncopyable
+{
+public:
+    typedef std::vector<toc_item *>::const_iterator iterator;
+
+    ~toc_item();
+
+    ustring title() const;
+    bool is_open() const;
+
+    std::vector<toc_item *> children() const;
+    iterator children_begin() const;
+    iterator children_end() const;
+
+private:
+    toc_item();
+
+    toc_item_private *d;
+    friend class toc;
+    friend class toc_private;
+    friend class toc_item_private;
+};
+
+}
+
+#endif


More information about the poppler mailing list