Commit 1064d758 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

kill unmaintained abiword backend

parent abf167af
......@@ -27,7 +27,6 @@ option(BUILD_CPP_TESTS "Whether compile the CPP 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)
option(ENABLE_LIBCURL "Build libcurl based HTTP support." OFF)
......@@ -114,10 +113,6 @@ if(ENABLE_ZLIB)
endif(ZLIB_FOUND)
set(ENABLE_ZLIB ${ZLIB_FOUND})
endif(ENABLE_ZLIB)
if(ENABLE_ABIWORD)
find_package(LibXml2)
set(ENABLE_ABIWORD ${LIBXML2_FOUND})
endif(ENABLE_ABIWORD)
if(ENABLE_LIBOPENJPEG)
find_package(LIBOPENJPEG)
set(ENABLE_LIBOPENJPEG ${LIBOPENJPEG_FOUND})
......@@ -172,10 +167,6 @@ if(TIFF_FOUND)
include_directories(${TIFF_INCLUDE_DIR})
set(ENABLE_LIBTIFF ON)
endif(TIFF_FOUND)
if(ENABLE_ABIWORD)
include_directories(${LIBXML2_INCLUDE_DIR})
add_definitions(${LIBXML2_DEFINITIONS})
endif(ENABLE_ABIWORD)
if(LIBOPENJPEG_FOUND)
include_directories(${LIBOPENJPEG_INCLUDE_DIR})
endif(LIBOPENJPEG_FOUND)
......@@ -342,12 +333,6 @@ endif(LIBOPENJPEG_FOUND)
if(USE_CMS)
set(poppler_LIBS ${poppler_LIBS} ${LCMS_LIBRARIES})
endif(USE_CMS)
if(ENABLE_ABIWORD)
set(poppler_SRCS ${poppler_SRCS}
poppler/ABWOutputDev.cc
)
set(poppler_LIBS ${poppler_LIBS} ${LIBXML2_LIBRARIES})
endif(ENABLE_ABIWORD)
if(WIN32)
# gdi32 is needed under win32
set(poppler_LIBS ${poppler_LIBS} gdi32)
......@@ -574,7 +559,6 @@ message("Building Poppler with support for:")
show_end_message("font configuration" ${font_configuration})
show_end_message_yesno("splash output" ENABLE_SPLASH)
show_end_message_yesno("cairo output" CAIRO_FOUND)
show_end_message_yesno("abiword output" ENABLE_ABIWORD)
show_end_message_yesno("qt4 wrapper" QT4_FOUND)
show_end_message_yesno("glib wrapper" ENABLE_GLIB)
show_end_message_yesno(" introspection" INTROSPECTION_FOUND)
......
......@@ -530,21 +530,6 @@ elif test x$enable_gtk_test = xtry; then
fi
AM_CONDITIONAL(BUILD_GTK_TEST, test x$enable_gtk_test = xyes -a x$enable_poppler_glib = xyes)
AC_ARG_ENABLE(abiword-output,
AC_HELP_STRING([--disable-abiword-output],
[Don't build the abiword backend.]),
enable_abiword_output=$enableval,
enable_abiword_output="try")
if test x$enable_abiword_output = xyes; then
PKG_CHECK_MODULES(ABIWORD, libxml-2.0)
elif test x$enable_abiword_output = xtry; then
PKG_CHECK_MODULES(ABIWORD, libxml-2.0,
[enable_abiword_output="yes"],
[enable_abiword_output="no"])
fi
AM_CONDITIONAL(BUILD_ABIWORD_OUTPUT, test x$enable_abiword_output = xyes)
AC_ARG_ENABLE(utils,
AC_HELP_STRING([--disable-utils],
[Don't compile poppler command line utils.]),
......@@ -647,7 +632,6 @@ echo "Building poppler with support for:"
echo " font configuration: $with_font_configuration"
echo " splash output: $enable_splash_output"
echo " cairo output: $enable_cairo_output"
echo " abiword output: $enable_abiword_output"
echo " qt4 wrapper: $enable_poppler_qt4"
echo " glib wrapper: $enable_poppler_glib"
echo " introspection: $found_introspection"
......
This diff is collapsed.
//========================================================================
//
// ABWOutputDev.h
//
// Copyright 2006-2007 Jauco Noordzij <jauco@jauco.nl>
// Copyright (C) 2009 Kovid Goyal <kovid@kovidgoyal.net>
//
//========================================================================
#ifndef ABWOUTPUTDEV_H
#define ABWOUTPUTDEV_H
#ifdef __GNUC__
#pragma interface
#endif
#include <stdio.h>
#include "goo/gtypes.h"
#include "goo/GooList.h"
#include "GfxFont.h"
#include "OutputDev.h"
#include "Catalog.h"
#include "UnicodeMap.h"
#include "PDFDoc.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#ifdef _WIN32
# define SLASH '\\'
#else
# define SLASH '/'
#endif
#define xoutRound(x) ((int)(x + 0.5))
class GfxState;
class GooString;
//------------------------------------------------------------------------
// ABWOutputDev
//------------------------------------------------------------------------
class ABWOutputDev: public OutputDev {
public:
// Open a text output file. If <fileName> is NULL, no file is written
// (this is useful, e.g., for searching text). If <useASCII7> is true,
// text is converted to 7-bit ASCII; otherwise, text is converted to
// 8-bit ISO Latin-1. <useASCII7> should also be set for Japanese
// (EUC-JP) text. If <rawOrder> is true, the text is kept in content
// stream order.
ABWOutputDev(xmlDocPtr ext_doc);
// Destructor.
virtual ~ABWOutputDev();
// Check if file was successfully created.
virtual GBool isOk() { return gTrue; }
//---- get info about output device
// Does this device use upside-down coordinates?
// (Upside-down means (0,0) is the top left corner of the page.)
virtual GBool upsideDown() { return gTrue; }
// Does this device use drawChar() or drawString()?
virtual GBool useDrawChar() { return gTrue; }
// Does this device use beginType3Char/endType3Char? Otherwise,
// text in Type 3 fonts will be drawn with drawChar/drawString.
virtual GBool interpretType3Chars() { return gFalse; }
// Does this device need non-text content?
virtual GBool needNonText() { return gFalse; }
//----- initialization and control
// Start a page.
virtual void startPage(int pageNum, GfxState *state);
// End a page.
virtual void endPage();
//----- update text state
virtual void updateFont(GfxState *state);
//----- text drawing
//new feature
virtual int DevType() {return 1234;}
int getPageWidth() { return maxPageWidth; }
int getPageHeight() { return maxPageHeight; }
float getBiggestSeperator(xmlNodePtr N_set, unsigned int direction, float * C1, float * C2);
void recursiveXYC(xmlNodePtr nodeset);
void splitNodes(float splitValue, unsigned int direction, xmlNodePtr N_parent, double extravalue);
virtual void beginString(GfxState *state, GooString *s);
virtual void endString(GfxState *state);
virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen);
void beginWord(GfxState *state, double x, double y);
void endWord();
void beginTextBlock(GfxState *state, double x, double y);
void endTextBlock();
void interpretXYTree();
void ATP_recursive(xmlNodePtr N_cur);
void cleanUpNode(xmlNodePtr N_parent, bool aggregateInfo);
void transformPage(xmlNodePtr N_parent);
void generateParagraphs();
void addAlignment(xmlNodePtr N_parent);
void setPDFDoc(PDFDoc *priv_pdfdoc);
void createABW();
private:
int maxPageWidth;
int maxPageHeight;
int G_pageNum;
int Style, maxStyle;
//A lot of values are nice to have around. I think that declaring some
//global variables that contain these values is faster & easier than reading
//them from the xml tree every time.
double height;
double wordSpace, charSpace;
double X1,X2,Y1,Y2,horDist, verDist, curDx, curDy;
bool mightBreak;
xmlDocPtr doc;
/* node pointers */
xmlNodePtr N_root, N_content, N_page, N_style, N_text, N_styleset, N_Block, N_word, N_column, N_colset;
xmlNodePtr outputDoc;
xmlXPathContextPtr xpathCtx;
static const unsigned int HORIZONTAL = 0;
static const unsigned int VERTICAL = 1;
UnicodeMap *uMap;
PDFDoc *pdfdoc;
int xmlLsCountNode(xmlNodePtr node);
};
#endif
......@@ -129,20 +129,6 @@ curl_sources = \
endif
if BUILD_ABIWORD_OUTPUT
abiword_sources = \
ABWOutputDev.h \
ABWOutputDev.cc
abiword_includes = \
$(ABIWORD_CFLAGS)
abiword_libs = \
$(ABIWORD_LIBS)
endif
if USE_CMS
cms_includes = $(LCMS_CFLAGS)
cms_libs = $(LCMS_LIBS)
......@@ -155,7 +141,6 @@ INCLUDES = \
$(splash_includes) \
$(cairo_includes) \
$(arthur_includes) \
$(abiword_includes) \
$(libtiff_includes) \
$(libpng_includes) \
$(libcurl_includes) \
......@@ -181,7 +166,6 @@ libpoppler_la_LIBADD = \
$(zlib_libs) \
$(libcurl_libs) \
$(libjpeg2000_libs) \
$(abiword_libs) \
$(FREETYPE_LIBS) \
$(FONTCONFIG_LIBS) \
$(PTHREAD_LIBS) \
......@@ -274,7 +258,6 @@ libpoppler_la_SOURCES = \
$(libjpeg_sources) \
$(zlib_sources) \
$(libjpeg2000_sources) \
$(abiword_sources) \
$(curl_sources) \
Annot.cc \
Array.cc \
......
......@@ -79,13 +79,3 @@ target_link_libraries(pdftohtml ${common_libs})
install(TARGETS pdftohtml DESTINATION bin)
install(FILES pdftohtml.1 DESTINATION share/man/man1)
if (ENABLE_ABIWORD)
# pdftoabw
set(pdftoabw_SOURCES ${common_srcs}
pdftoabw.cc
)
add_executable(pdftoabw ${pdftoabw_SOURCES})
target_link_libraries(pdftoabw ${common_libs} ${LIBXML2_LIBRARIES})
install(TARGETS pdftoabw DESTINATION bin)
endif (ENABLE_ABIWORD)
......@@ -16,26 +16,13 @@ INCLUDES = \
-I$(top_srcdir)/utils \
-I$(top_srcdir)/poppler \
$(UTILS_CFLAGS) \
$(FONTCONFIG_CFLAGS) \
$(ABIWORD_CFLAGS)
$(FONTCONFIG_CFLAGS)
LDADD = \
$(top_builddir)/poppler/libpoppler.la \
$(UTILS_LIBS) \
$(FONTCONFIG_LIBS)
if BUILD_ABIWORD_OUTPUT
pdftoabw_SOURCES = \
pdftoabw.cc \
$(common)
pdftoabw_LDADD = $(LDADD) $(ABIWORD_LIBS)
pdftoabw_binary = pdftoabw
endif
AM_LDFLAGS = @auto_import_flags@
bin_PROGRAMS = \
......@@ -45,8 +32,7 @@ bin_PROGRAMS = \
pdftops \
pdftotext \
pdftohtml \
$(pdftoppm_binary) \
$(pdftoabw_binary)
$(pdftoppm_binary)
dist_man1_MANS = \
pdffonts.1 \
......
/*
* Copyright (C) 2007 Jauco Noordzij <jauco@jauco.nl>
* Copyright (C) 2007 Dominic Lachowicz <cinamod@hotmail.com>
* Copyright (C) 2007 Kouhei Sutou <kou@cozmixng.org>
* Copyright (C) 2009 Jakub Wilk <ubanus@users.sf.net>
* Copyright (C) 2009, 2010 Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
*
* 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 "config.h"
#include <poppler-config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#ifdef HAVE_DIRENT_H
#include <dirent.h>
#endif
#include <time.h>
#include "parseargs.h"
#include "goo/GooString.h"
#include "goo/gmem.h"
#include "Object.h"
#include "Stream.h"
#include "Array.h"
#include "Dict.h"
#include "XRef.h"
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
#include "PDFDocFactory.h"
#include "ABWOutputDev.h"
#include "PSOutputDev.h"
#include "GlobalParams.h"
#include "Error.h"
#include "goo/gfile.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
static int firstPage = 1;
static int lastPage = 0;
static GBool quiet = gFalse;
static GBool printHelp = gFalse;
static GBool printVersion = gFalse;
static GBool stout = gFalse;
static char ownerPassword[33] = "";
static char userPassword[33] = "";
// static char textEncName[128] = "";
static const ArgDesc argDesc[] = {
{"-f", argInt, &firstPage, 0,
"first page to convert"},
{"-l", argInt, &lastPage, 0,
"last page to convert"},
{"--stdout" ,argFlag, &stout, 0,
"use standard output"},
{"--opw", argString, ownerPassword, sizeof(ownerPassword),
"owner password (for encrypted files)"},
{"--upw", argString, userPassword, sizeof(userPassword),
"user password (for encrypted files)"},
{"-q", argFlag, &quiet, 0,
"don't print any messages or errors"},
{"-v", argFlag, &printVersion, 0,
"print copyright and version info"},
{"-h", argFlag, &printHelp, 0,
"print usage information"},
{"-help", argFlag, &printHelp, 0,
"print usage information"},
{"--help", argFlag, &printHelp, 0,
"print usage information"},
{"-?", argFlag, &printHelp, 0,
"print usage information"},
{NULL}
};
int main(int argc, char *argv[]) {
GBool ok;
PDFDoc *doc = NULL;
GooString *fileName = NULL;
// GooString *abwFileName = NULL;
ABWOutputDev *abwOut = NULL;
// GBool ok;
GooString *ownerPW, *userPW;
Object info;
int result = 1;
char * outpName;
xmlDocPtr XMLdoc = NULL;
// parse args
ok = parseArgs(argDesc, &argc, argv);
if (!ok || argc < 2 || argc > 3 || printVersion || printHelp) {
fprintf(stderr, "pdftoabw version %s\n", PACKAGE_VERSION);
fprintf(stderr, "%s\n", popplerCopyright);
fprintf(stderr, "%s\n", xpdfCopyright);
if (!printVersion) {
printUsage("pdftoabw", "<PDF-file> [abw-file]", argDesc);
}
goto err0;
}
globalParams = new GlobalParams();
if (quiet) {
globalParams->setErrQuiet(quiet);
}
fileName = new GooString(argv[1]);
if (stout || (argc < 3)){
outpName = "-";
}
else {
outpName = argv[2];
}
if (ownerPassword[0]) {
ownerPW = new GooString(ownerPassword);
} else {
ownerPW = NULL;
}
if (userPassword[0]) {
userPW = new GooString(userPassword);
} else {
userPW = NULL;
}
if (fileName->cmp("-") == 0) {
delete fileName;
fileName = new GooString("fd://0");
}
doc = PDFDocFactory().createPDFDoc(*fileName, ownerPW, userPW);
if (userPW) {
delete userPW;
}
if (ownerPW) {
delete ownerPW;
}
if (!doc || !doc->isOk())
{
fprintf (stderr, "Error opening PDF %s\n", fileName->getCString());
goto error;
}
// check for copy permission
if (!doc->okToCopy()) {
fprintf(stderr, "Copying of text from this document is not allowed.\n");
goto error;
}
XMLdoc = xmlNewDoc(BAD_CAST "1.0");
abwOut = new ABWOutputDev(XMLdoc);
abwOut->setPDFDoc(doc);
if (lastPage == 0 || lastPage > doc->getNumPages ()) lastPage = doc->getNumPages();
if (firstPage < 1) firstPage = 1;
if (abwOut->isOk())
{
doc->displayPages(abwOut, firstPage, lastPage, 72, 72, 0, gTrue, gFalse, gFalse);
abwOut->createABW();
}
if (xmlSaveFormatFileEnc(outpName, XMLdoc, "UTF-8", 1) == -1)
{
fprintf (stderr, "Error saving to %s\n", outpName);
goto error;
}
result = 0;
error:
// clean up
if(globalParams) delete globalParams;
if(doc) delete doc;
delete fileName;
if(XMLdoc) xmlFreeDoc(XMLdoc);
if(abwOut) delete abwOut;
err0:
// check for memory leaks
Object::memCheck(stderr);
gMemReport(stderr);
return result;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment