-fpermissive to allow GCC to compile old C++
[oweals/cde.git] / cde / programs / dtmail / dtmail / DmxPrintOptions.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: DmxPrintOptions.h /main/6 1996/09/23 13:15:43 mgreess $ */
24
25 #ifndef _DMX_PRINT_OPTIONS_H
26 #define _DMX_PRINT_OPTIONS_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
77 #include <stdio.h>
78 #include <stdlib.h>
79 #include <unistd.h>
80 #include <string.h>
81 #include <sys/types.h>
82 #include <ctype.h>
83 #include <Dt/PrintOptionsP.h>
84 #include <DtMail/PropUi.hh>
85 #include "Dmx.h"
86 #include "IndexedOptionMenu.h"
87 #include "UIComponent.h"
88
89 #define DMX_PROPKEY_HEADER_LEFT         "headerleft"
90 #define DMX_PROPKEY_HEADER_RIGHT        "headerright"
91 #define DMX_PROPKEY_FOOTER_LEFT         "footerleft"
92 #define DMX_PROPKEY_FOOTER_RIGHT        "footerright"
93
94 #define DMX_PROPKEY_MARGIN_TOP          "margintop"
95 #define DMX_PROPKEY_MARGIN_RIGHT        "marginright"
96 #define DMX_PROPKEY_MARGIN_BOTTOM       "marginbottom"
97 #define DMX_PROPKEY_MARGIN_LEFT         "marginleft"
98
99 #define DMX_PROPKEY_PRINT_HEADERS       "printheaders"
100 #define DMX_PROPKEY_MESSAGE_SEPARATOR   "messageseparator"
101 #define DMX_PROPKEY_SEPARATOR_STRING    "separatorstring"
102
103 #define DMX_PROPVAL_EMPTY               "Empty"
104 #define DMX_PROPVAL_CC_HEADER           "CCHeader"
105 #define DMX_PROPVAL_DATE_HEADER         "DateHeader"
106 #define DMX_PROPVAL_FROM_HEADER         "FromHeader"
107 #define DMX_PROPVAL_SUBJECT_HEADER      "SubjectHeader"
108 #define DMX_PROPVAL_TO_HEADER           "ToHeader"
109 #define DMX_PROPVAL_PAGE_NUMBER         "PageNumber"
110 #define DMX_PROPVAL_USER_NAME           "UserName"
111
112 #define DMX_PROPVAL_DFLT_MARGIN         "1.0 in"
113
114 #define DMX_PROPVAL_NONE                "None"
115 #define DMX_PROPVAL_STANDARD            "Standard"
116 #define DMX_PROPVAL_ABBREVIATED         "Abbreviated"
117 #define DMX_PROPVAL_ALL                 "All"
118
119 #define DMX_PROPVAL_NEW_LINE            "NewLine"
120 #define DMX_PROPVAL_BLANK_LINE          "BlankLine"
121 #define DMX_PROPVAL_CHARACTER_LINE      "CharacterLine"
122 #define DMX_PROPVAL_PAGE_BREAK          "PageBreak"
123 #define DMX_PROPVAL_NEW_JOB             "NewJob"
124
125 struct DmxpoPropKey
126 {
127         int             which;
128         char            *key;
129         char            *dflt_prop_string;
130 };
131
132 struct DmxpoPropValue
133 {
134         int             which;
135         char            *prop_string;
136         int             set_id;
137         int             msg_id;
138         char            *dflt_string;
139 };
140
141 class DmxPrintOptions : public UIComponent
142 {
143
144 private:
145     DtVirtArray<IndexedOptionMenu *>
146                         *_iom_array;
147     DtVirtArray<PropUiItem *>
148                         *_propui_array;
149     int                 _propui_array_iterator;
150
151     Widget              _parent;
152     Widget              _form;
153
154     Widget              _hdrftr_frame;
155     Widget              _margin_frame;
156
157     IndexedOptionMenu   *_msgsep_iom;
158     IndexedOptionMenu   *_prthdr_iom;
159
160     PropSource          *_prop_source;
161
162     PropUiItem                  *propKeyToPropItem(char*);
163     static DmxpoPropKey         *enumToPropKey(int, int, DmxpoPropKey*);
164     static DmxpoPropValue       *stringToPropValue(
165                                                 const char*,
166                                                 int,
167                                                 DmxpoPropValue*);
168     static char                 *isValidMarginSpec(
169                                                 PropUiItem*,
170                                                 void*);
171 public:
172
173     DmxPrintOptions ( Widget );
174     ~DmxPrintOptions (void);
175
176     PropUiItem                  *getFirstProp(void);
177     PropUiItem                  *getNextProp(void);
178     int                         getNumProps(void);
179
180     static DmxStringTypeEnum    getHdrFtrSpec(_DtPrintHdrFtrEnum which);
181     static const char           *getMarginSpec(_DtPrintMarginEnum which);
182     static DmxMsgSeparatorEnum  getMessageSeparator(void);
183     static DmxPrintHeadersEnum  getPrintedHeaders(void);
184     static const char           *getSeparatorString(void);
185 };
186
187 #endif // _DMX_PRINT_OPTIONS_H