Initial import of the CDE 2.1.30 sources from the Open Group.
[oweals/cde.git] / cde / programs / dtmail / dtmail / DmxPrintOptions.h
1 /* $XConsortium: DmxPrintOptions.h /main/6 1996/09/23 13:15:43 mgreess $ */
2
3 #ifndef _DMX_PRINT_OPTIONS_H
4 #define _DMX_PRINT_OPTIONS_H
5
6 /*
7  *+SNOTICE
8  *
9  *      $:$
10  *
11  *      RESTRICTED CONFIDENTIAL INFORMATION:
12  *      
13  *      The information in this document is subject to special
14  *      restrictions in a confidential disclosure agreement between
15  *      HP, IBM, Sun, USL, SCO and Univel.  Do not distribute this
16  *      document outside HP, IBM, Sun, USL, SCO, or Univel without
17  *      Sun's specific written approval.  This document and all copies
18  *      and derivative works thereof must be returned or destroyed at
19  *      Sun's request.
20  *
21  *      Copyright 1994 Sun Microsystems, Inc.  All rights reserved.
22  *
23  *+ENOTICE
24  */
25 /*
26  *                   Common Desktop Environment
27  *
28  *   (c) Copyright 1993, 1994, 1995 Hewlett-Packard Company
29  *   (c) Copyright 1993, 1994, 1995 International Business Machines Corp.
30  *   (c) Copyright 1993, 1994, 1995 Sun Microsystems, Inc.
31  *   (c) Copyright 1993, 1994, 1995 Novell, Inc.
32  *   (c) Copyright 1995 Digital Equipment Corp.
33  *   (c) Copyright 1995 Fujitsu Limited
34  *   (c) Copyright 1995 Hitachi, Ltd.
35  *                                                                   
36  *
37  *                     RESTRICTED RIGHTS LEGEND                              
38  *
39  *Use, duplication, or disclosure by the U.S. Government is subject to
40  *restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in
41  *Technical Data and Computer Software clause in DFARS 252.227-7013.  Rights
42  *for non-DOD U.S. Government Departments and Agencies are as set forth in
43  *FAR 52.227-19(c)(1,2).
44
45  *Hewlett-Packard Company, 3000 Hanover Street, Palo Alto, CA 94304 U.S.A.
46  *International Business Machines Corp., Route 100, Somers, NY 10589 U.S.A. 
47  *Sun Microsystems, Inc., 2550 Garcia Avenue, Mountain View, CA 94043 U.S.A.
48  *Novell, Inc., 190 River Road, Summit, NJ 07901 U.S.A.
49  *Digital Equipment Corp., 111 Powdermill Road, Maynard, MA 01754, U.S.A.
50  *Fujitsu Limited, 1015, Kamikodanaka Nakahara-Ku, Kawasaki 211, Japan
51  *Hitachi, Ltd., 6, Kanda Surugadai 4-Chome, Chiyoda-ku, Tokyo 101, Japan
52  */
53
54
55 #include <stdio.h>
56 #include <stdlib.h>
57 #include <unistd.h>
58 #include <string.h>
59 #include <sys/types.h>
60 #include <ctype.h>
61 #include <Dt/PrintOptionsP.h>
62 #include <DtMail/PropUi.hh>
63 #include "Dmx.h"
64 #include "IndexedOptionMenu.h"
65 #include "UIComponent.h"
66
67 #define DMX_PROPKEY_HEADER_LEFT         "headerleft"
68 #define DMX_PROPKEY_HEADER_RIGHT        "headerright"
69 #define DMX_PROPKEY_FOOTER_LEFT         "footerleft"
70 #define DMX_PROPKEY_FOOTER_RIGHT        "footerright"
71
72 #define DMX_PROPKEY_MARGIN_TOP          "margintop"
73 #define DMX_PROPKEY_MARGIN_RIGHT        "marginright"
74 #define DMX_PROPKEY_MARGIN_BOTTOM       "marginbottom"
75 #define DMX_PROPKEY_MARGIN_LEFT         "marginleft"
76
77 #define DMX_PROPKEY_PRINT_HEADERS       "printheaders"
78 #define DMX_PROPKEY_MESSAGE_SEPARATOR   "messageseparator"
79 #define DMX_PROPKEY_SEPARATOR_STRING    "separatorstring"
80
81 #define DMX_PROPVAL_EMPTY               "Empty"
82 #define DMX_PROPVAL_CC_HEADER           "CCHeader"
83 #define DMX_PROPVAL_DATE_HEADER         "DateHeader"
84 #define DMX_PROPVAL_FROM_HEADER         "FromHeader"
85 #define DMX_PROPVAL_SUBJECT_HEADER      "SubjectHeader"
86 #define DMX_PROPVAL_TO_HEADER           "ToHeader"
87 #define DMX_PROPVAL_PAGE_NUMBER         "PageNumber"
88 #define DMX_PROPVAL_USER_NAME           "UserName"
89
90 #define DMX_PROPVAL_DFLT_MARGIN         "1.0 in"
91
92 #define DMX_PROPVAL_NONE                "None"
93 #define DMX_PROPVAL_STANDARD            "Standard"
94 #define DMX_PROPVAL_ABBREVIATED         "Abbreviated"
95 #define DMX_PROPVAL_ALL                 "All"
96
97 #define DMX_PROPVAL_NEW_LINE            "NewLine"
98 #define DMX_PROPVAL_BLANK_LINE          "BlankLine"
99 #define DMX_PROPVAL_CHARACTER_LINE      "CharacterLine"
100 #define DMX_PROPVAL_PAGE_BREAK          "PageBreak"
101 #define DMX_PROPVAL_NEW_JOB             "NewJob"
102
103 struct DmxpoPropKey
104 {
105         int             which;
106         char            *key;
107         char            *dflt_prop_string;
108 };
109
110 struct DmxpoPropValue
111 {
112         int             which;
113         char            *prop_string;
114         int             set_id;
115         int             msg_id;
116         char            *dflt_string;
117 };
118
119 class DmxPrintOptions : public UIComponent
120 {
121
122 private:
123     DtVirtArray<IndexedOptionMenu *>
124                         *_iom_array;
125     DtVirtArray<PropUiItem *>
126                         *_propui_array;
127     int                 _propui_array_iterator;
128
129     Widget              _parent;
130     Widget              _form;
131
132     Widget              _hdrftr_frame;
133     Widget              _margin_frame;
134
135     IndexedOptionMenu   *_msgsep_iom;
136     IndexedOptionMenu   *_prthdr_iom;
137
138     PropSource          *_prop_source;
139
140     PropUiItem                  *propKeyToPropItem(char*);
141     static DmxpoPropKey         *enumToPropKey(int, int, DmxpoPropKey*);
142     static DmxpoPropValue       *stringToPropValue(
143                                                 const char*,
144                                                 int,
145                                                 DmxpoPropValue*);
146     static char                 *isValidMarginSpec(
147                                                 PropUiItem*,
148                                                 void*);
149 public:
150
151     DmxPrintOptions ( Widget );
152     ~DmxPrintOptions (void);
153
154     PropUiItem                  *getFirstProp(void);
155     PropUiItem                  *getNextProp(void);
156     int                         getNumProps(void);
157
158     static DmxStringTypeEnum    getHdrFtrSpec(_DtPrintHdrFtrEnum which);
159     static const char           *getMarginSpec(_DtPrintMarginEnum which);
160     static DmxMsgSeparatorEnum  getMessageSeparator(void);
161     static DmxPrintHeadersEnum  getPrintedHeaders(void);
162     static const char           *getSeparatorString(void);
163 };
164
165 #endif // _DMX_PRINT_OPTIONS_H