xref: /aoo41x/main/padmin/source/prtsetup.hxx (revision 23e9c6ca)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _PAD_PRTSETUP_HXX_
25 #define _PAD_PRTSETUP_HXX_
26 
27 #include "helper.hxx"
28 
29 #include "tools/link.hxx"
30 
31 #include "vcl/tabdlg.hxx"
32 #include "vcl/tabpage.hxx"
33 #include "vcl/tabctrl.hxx"
34 #include "vcl/button.hxx"
35 #include "vcl/fixed.hxx"
36 #include "vcl/lstbox.hxx"
37 #include "vcl/field.hxx"
38 #include "vcl/combobox.hxx"
39 #include "vcl/ppdparser.hxx"
40 #include "vcl/printerinfomanager.hxx"
41 
42 namespace padmin {
43 
44 class RTSPaperPage;
45 class RTSDevicePage;
46 class RTSOtherPage;
47 class RTSFontSubstPage;
48 class RTSCommandPage;
49 
50 class RTSDialog : public TabDialog
51 {
52 	friend class RTSPaperPage;
53 	friend class RTSDevicePage;
54 	friend class RTSOtherPage;
55 	friend class RTSFontSubstPage;
56 	friend class RTSCommandPage;
57 
58 	::psp::PrinterInfo		m_aJobData;
59 	String					m_aPrinter;
60 
61 	// controls
62 	TabControl				m_aTabControl;
63 	OKButton				m_aOKButton;
64 	CancelButton			m_aCancelButton;
65 
66 	// pages
67 	RTSPaperPage*			m_pPaperPage;
68 	RTSDevicePage*			m_pDevicePage;
69 	RTSOtherPage*			m_pOtherPage;
70 	RTSFontSubstPage*		m_pFontSubstPage;
71 	RTSCommandPage*			m_pCommandPage;
72 
73 	// some resources
74 	String					m_aInvalidString;
75 	String					m_aFromDriverString;
76 
77 	DECL_LINK( ActivatePage, TabControl* );
78 	DECL_LINK( ClickButton, Button* );
79 
80 	// helper functions
81 	void insertAllPPDValues( ListBox&, const psp::PPDParser*, const psp::PPDKey* );
82 public:
83 	RTSDialog( const ::psp::PrinterInfo& rJobData, const String& rPrinter, bool bAllPages, Window* pParent = NULL );
84 	~RTSDialog();
85 
getSetup() const86 	const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
87 };
88 
89 class RTSPaperPage : public TabPage
90 {
91 	RTSDialog*			m_pParent;
92 
93 	FixedText			m_aPaperText;
94 	ListBox				m_aPaperBox;
95 
96 	FixedText			m_aOrientText;
97 	ListBox				m_aOrientBox;
98 
99 	FixedText			m_aDuplexText;
100 	ListBox				m_aDuplexBox;
101 
102 	FixedText			m_aSlotText;
103 	ListBox				m_aSlotBox;
104 
105 	DECL_LINK( SelectHdl, ListBox* );
106 public:
107 	RTSPaperPage( RTSDialog* );
108 	~RTSPaperPage();
109 
110 	void update();
111 
getOrientation()112 	String getOrientation() { return m_aOrientBox.GetSelectEntry(); }
113 };
114 
115 class RTSDevicePage : public TabPage
116 {
117 	RTSDialog*			m_pParent;
118 
119 	String				m_aSpaceColor;
120 	String				m_aSpaceGray;
121 
122 	FixedText			m_aPPDKeyText;
123 	ListBox				m_aPPDKeyBox;
124 
125 	FixedText			m_aPPDValueText;
126 	ListBox				m_aPPDValueBox;
127 
128 	FixedText			m_aLevelText;
129 	ListBox				m_aLevelBox;
130 
131 	FixedText			m_aSpaceText;
132 	ListBox				m_aSpaceBox;
133 
134 	FixedText			m_aDepthText;
135 	ListBox				m_aDepthBox;
136 
137 	void FillValueBox( const ::psp::PPDKey* );
138 
139 	DECL_LINK( SelectHdl, ListBox* );
140 public:
141 	RTSDevicePage( RTSDialog* );
142 	~RTSDevicePage();
143 
144 	void update();
145 
146 	sal_uLong getLevel();
147 	sal_uLong getPDFDevice();
getDepth()148 	sal_uLong getDepth() { return m_aDepthBox.GetSelectEntry().ToInt32(); }
getColorDevice()149 	sal_uLong getColorDevice()
150 	{
151 		String aSpace( m_aSpaceBox.GetSelectEntry() );
152 		return aSpace == m_aSpaceColor ? 1 : ( aSpace == m_aSpaceGray ? -1 : 0 );
153 	}
154 };
155 
156 class RTSOtherPage : public TabPage
157 {
158 	RTSDialog*			m_pParent;
159 
160 	FixedText			m_aLeftTxt;
161 	MetricField			m_aLeftLB;
162 	FixedText			m_aTopTxt;
163 	MetricField			m_aTopLB;
164 	FixedText			m_aRightTxt;
165 	MetricField			m_aRightLB;
166 	FixedText			m_aBottomTxt;
167 	MetricField			m_aBottomLB;
168 	FixedText			m_aCommentTxt;
169 	Edit				m_aCommentEdt;
170 	PushButton			m_aDefaultBtn;
171 
172 	void initValues();
173 
174 	DECL_LINK( ClickBtnHdl, Button *);
175 
176 public:
177 	RTSOtherPage( RTSDialog* );
178 	~RTSOtherPage();
179 
180 	void save();
181 };
182 
183 class RTSFontSubstPage : public TabPage
184 {
185 	RTSDialog*			m_pParent;
186 
187 	FixedText			m_aSubstitutionsText;
188 	DelMultiListBox		m_aSubstitutionsBox;
189 	FixedText			m_aFromFontText;
190 	ComboBox			m_aFromFontBox;
191 	FixedText			m_aToFontText;
192 	ListBox				m_aToFontBox;
193 
194 	PushButton			m_aAddButton;
195 	PushButton			m_aRemoveButton;
196 	CheckBox			m_aEnableBox;
197 
198 	DECL_LINK( ClickBtnHdl, Button* );
199 	DECL_LINK( SelectHdl, ListBox* );
200 	DECL_LINK( DelPressedHdl, ListBox* );
201 
202 	void update();
203 public:
204 	RTSFontSubstPage( RTSDialog* );
205 	~RTSFontSubstPage();
206 };
207 
208 } // namespace
209 
210 #endif // _PAD_PRTSETUP_HXX
211