-fpermissive to allow GCC to compile old C++
[oweals/cde.git] / cde / programs / dtmail / dtmail / DmxPrintJob.h
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: DmxPrintJob.h /main/3 1996/04/12 14:12:32 mgreess $ */
24
25 #ifndef _DMX_PRINT_JOB_H
26 #define _DMX_PRINT_JOB_H
27
28 /*
29  *+SNOTICE
30  *
31  *      $:$
32  *
33  *      RESTRICTED CONFIDENTIAL INFORMATION:
34  *      
35  *      The information in this document is subject to special
36  *      restrictions in a confidential disclosure agreement between
37  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
38  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
39  *      Sun's specific written approval.  This document and all copies
40  *      and derivative works thereof must be returned or destroyed at
41  *      Sun's request.
42  *
43  *      Copyright 1994 Sun Microsystems, Inc.  All rights reserved.
44  *
45  *+ENOTICE
46  */
47 /*
48  *                   Common Desktop Environment
49  *
50  *   (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
51  *   (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
52  *   (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
53  *   (c) Copyright 1993, 1994, 1995 Novell, Inc.
54  *   (c) Copyright 1995 Digital Equipment Corp.
55  *   (c) Copyright 1995 Fujitsu Limited
56  *   (c) Copyright 1995 Hitachi, Ltd.
57  *                                                                   
58  *
59  *                     RESTRICTED RIGHTS LEGEND                              
60  *
61  *Use, duplication, or disclosure by the U.S. Government is subject to
62  *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
63  *Technical Data and Computer Software clause in DFARS 252.227-7013.  Rights
64  *for non-DOD U.S. Government Departments and Agencies are as set forth in
65  *FAR 52.227-19(c)(1,2).
66
67  *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
68  *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A. 
69  *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
70  *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
71  *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
72  *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
73  *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
74  */
75
76 #include <stdio.h>
77 #include <stdlib.h>
78 #include <unistd.h>
79 #include <string.h>
80 #include <sys/types.h>
81 #include <ctype.h>
82 #include "Dmx.h"
83 #include "DmxPrintOptions.h"
84 #include "DmxPrintOutput.h"
85 #include "DmxPrintSetup.h"
86 #include "DtMailTypes.h"
87 #include "MainWindow.h"
88 #include "OptCmd.h"
89 #include "UIComponent.h"
90
91 typedef struct _dmx_msg_info 
92 {
93     int         end_position;
94     DmxMsg      *msg;
95 } DmxMsgInfo;
96
97 class DmxPrintJob : public UIComponent
98 {
99     private:
100         DmxMsg                  *_next_msg;
101         char                    *_filename;
102         DmxMailbox              *_mailbox;
103         MainWindow              *_parent;
104         DmxPrintOutput          *_print_output;
105         DmxPrintSetup           *_print_setup;
106         DtPrintSetupData        *_print_data;
107         Widget                  _pshell;
108         DtMailBoolean           _silent;
109
110         DmxMsgInfo              *_spool_msg_info;
111         int                     _spool_nmsgs_done;
112         int                     _spool_nmsgs_total;
113         int                     _spool_npages_done;
114         int                     _spool_npages_total;
115
116 #ifndef USE_XP_SERVER
117         Widget                  _nextpage_shell;
118         Widget                  _nextpage_button;
119 #endif
120         static void     cancelCB (Widget, XtPointer, XtPointer);
121         static void     closeDisplayCB (Widget, XtPointer, XtPointer);
122         static void     pdmNotificationCB (Widget, XtPointer, XtPointer);
123         static void     pdmSetupCB (Widget, XtPointer, XtPointer);
124         static void     printCB (Widget, XtPointer, XtPointer);
125         static void     printOnePageCB (Widget, XtPointer, XtPointer);
126
127         void            createPrintShell (void);
128         void            createOutputWidgets (void);
129         void            doPrint (void);
130         static void     finishedPrintToFile(
131                                         Display*,
132                                         XPContext,
133                                         XPGetDocStatus,
134                                         XPointer);
135         char *          getPageHeaderString( DmxMsg*, DmxStringTypeEnum);
136         Boolean         loadOutputWidgets (void);
137         void            updatePageHeaders(
138                                         DmxMsg*,
139                                         DmxStringTypeEnum,
140                                         DmxStringTypeEnum,
141                                         DmxStringTypeEnum,
142                                         DmxStringTypeEnum);
143     public:
144         DmxPrintJob (char*, DtMailBoolean, MainWindow*);
145         ~DmxPrintJob (void);
146
147         void            cancel (void);
148         void            execute (void);
149 };
150
151 #endif // _DMX_PRINT_JOB_H