Back to index

tetex-bin  3.0
print-internal.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2002-2004 Paul Vojta and the xdvik development team
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to
00006  * deal in the Software without restriction, including without limitation the
00007  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
00008  * sell copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  * 
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00015  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00016  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00017  * NONINFRINGEMENT.  IN NO EVENT SHALL ANY AUTHO OF THIS SOFTWARE BE
00018  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
00019  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00020  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00021  * SOFTWARE.
00022  */
00023 
00024 #ifndef PRINT_INTERNAL_H_
00025 #define PRINT_INTERNAL_H_
00026 
00027 #include "dvi-init.h"
00028 #include "print-dialog.h"
00029 
00030 typedef enum { FMT_PS, FMT_PS2PDF, FMT_DVI, FMT_ISO_8859_1, FMT_UTF8, FMT_NONE } outputFormatT;
00031 
00032 /* file IO help struct */
00033 struct file_IO {
00034     FILE *fp;
00035     char *fname;
00036 };
00037 
00038 /* collection of all file IOs used in printing/saving */
00039 struct file_info {
00040     struct file_IO dvi_in;
00041     struct file_IO dvi_tmp;
00042     struct file_IO dvi_out;
00043     struct file_IO ps_out;
00044     struct file_IO pdf_out;
00045     struct file_IO txt_out;
00046 };
00047 
00048 /* stacks for communication with selection routines */
00049 struct specials_stack_elem {
00050     char *content;          /* string content */
00051 };
00052 
00053 struct specials_stack {
00054     size_t stack_len;
00055     struct specials_stack_elem *items;
00056 };
00057 
00058 
00059 /* wrapper struct for all kinds of information about selected pages. */
00060 struct select_pages_info {
00061     printOrSaveActionT act; /* whether we're printing or saving */
00062     int from;               /* lower bound of page range to be selected */
00063     int to;                 /* upper bound of page range to be selected */
00064     struct file_info *finfo;       /* additional file info pointer */
00065     /* callback function that says whether a page should be selected or not;
00066        will be passed a pointer to the current struct select_pages_info,
00067        and the current page */
00068     Boolean (*callback)(struct select_pages_info *info, int page);
00069     struct specials_stack warn_files;     /* collect warnings about included files */
00070     dviErrFlagT errflag;    /* collect all kinds of errors that can happen while copying */
00071 };
00072 
00073 extern void internal_print(struct select_pages_info *pinfo);
00074 extern void internal_save(struct select_pages_info *pinfo,
00075                        outputFormatT output_format);
00076 
00077 #endif /* PRINT_INTERNAL_H_ */
00078