]> www.fi.muni.cz Git - evince.git/commitdiff
[pdf] Update to poppler API changes
authorCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 8 Jul 2010 15:39:26 +0000 (17:39 +0200)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Thu, 8 Jul 2010 15:39:26 +0000 (17:39 +0200)
backend/pdf/ev-poppler.cc
configure.ac

index 655d5897f8b893668721bca813b0c2ba2225f3e3..64ac3089c1b871b43614350e6b64a9eae3ae250e 100644 (file)
@@ -1906,12 +1906,18 @@ pdf_selection_get_selected_text (EvSelection     *selection,
                                 EvRectangle     *points)
 {
        PopplerPage *poppler_page;
-       PopplerRectangle r;
-       double height;
        char *retval;
-       
+
        poppler_page = POPPLER_PAGE (page->backend_page);
 
+#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
+       retval = poppler_page_get_selected_text (poppler_page,
+                                                (PopplerSelectionStyle)style,
+                                                (PopplerRectangle *)points);
+#else
+       PopplerRectangle r;
+       double height;
+
        poppler_page_get_size (poppler_page, NULL, &height);
        r.x1 = points->x1;
        r.y1 = height - points->y2;
@@ -1921,6 +1927,7 @@ pdf_selection_get_selected_text (EvSelection     *selection,
        retval = poppler_page_get_text (poppler_page,
                                        (PopplerSelectionStyle)style,
                                        &r);
+#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
 
        return retval;
 }
@@ -2008,6 +2015,20 @@ pdf_document_text_get_text_mapping (EvDocumentText *document_text,
        return retval;
 }
 
+#ifdef HAVE_POPPLER_PAGE_GET_SELECTED_TEXT
+static gchar *
+pdf_document_text_get_text (EvDocumentText  *selection,
+                           EvPage          *page)
+{
+       PopplerPage *poppler_page;
+
+       g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
+
+       poppler_page = POPPLER_PAGE (page->backend_page);
+
+       return poppler_page_get_text (poppler_page);
+}
+#else
 static gchar *
 pdf_document_text_get_text (EvDocumentText  *selection,
                            EvPage          *page)
@@ -2027,6 +2048,7 @@ pdf_document_text_get_text (EvDocumentText  *selection,
                                      POPPLER_SELECTION_WORD,
                                      &r);
 }
+#endif /* HAVE_POPPLER_PAGE_GET_SELECTED_TEXT */
 
 #ifdef HAVE_POPPLER_PAGE_GET_TEXT_LAYOUT
 static gboolean
index 5135ecb64f16f213a96c25ad32ade24048c5ee34..8b7a28684e0a96c9ff22d32f9e852669fc03adc4 100644 (file)
@@ -481,6 +481,7 @@ if test "x$enable_pdf" = "xyes"; then
            evince_save_LIBS=$LIBS
            LIBS="$LIBS $POPPLER_LIBS"
            AC_CHECK_FUNCS(poppler_page_get_text_layout)
+           AC_CHECK_FUNCS(poppler_page_get_selected_text)
            LIBS=$evince_save_LIBS
            PKG_CHECK_MODULES(CAIRO_PDF, cairo-pdf, enable_cairo_pdf=yes, enable_cairo_pdf=no)
            if test x$enable_cairo_pdf = xyes; then