xref: /trunk/main/padmin/source/prtsetup.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _PAD_PRTSETUP_HXX_
29 #define _PAD_PRTSETUP_HXX_
30 
31 #include "helper.hxx"
32 
33 #include "tools/link.hxx"
34 
35 #include "vcl/tabdlg.hxx"
36 #include "vcl/tabpage.hxx"
37 #include "vcl/tabctrl.hxx"
38 #include "vcl/button.hxx"
39 #include "vcl/fixed.hxx"
40 #include "vcl/lstbox.hxx"
41 #include "vcl/field.hxx"
42 #include "vcl/combobox.hxx"
43 #include "vcl/ppdparser.hxx"
44 #include "vcl/printerinfomanager.hxx"
45 
46 namespace padmin {
47 
48 class RTSPaperPage;
49 class RTSDevicePage;
50 class RTSOtherPage;
51 class RTSFontSubstPage;
52 class RTSCommandPage;
53 
54 class RTSDialog : public TabDialog
55 {
56 	friend class RTSPaperPage;
57 	friend class RTSDevicePage;
58 	friend class RTSOtherPage;
59 	friend class RTSFontSubstPage;
60 	friend class RTSCommandPage;
61 
62 	::psp::PrinterInfo		m_aJobData;
63 	String					m_aPrinter;
64 
65 	// controls
66 	TabControl				m_aTabControl;
67 	OKButton				m_aOKButton;
68 	CancelButton			m_aCancelButton;
69 
70 	// pages
71 	RTSPaperPage*			m_pPaperPage;
72 	RTSDevicePage*			m_pDevicePage;
73 	RTSOtherPage*			m_pOtherPage;
74 	RTSFontSubstPage*		m_pFontSubstPage;
75 	RTSCommandPage*			m_pCommandPage;
76 
77 	// some resources
78 	String					m_aInvalidString;
79 	String					m_aFromDriverString;
80 
81 	DECL_LINK( ActivatePage, TabControl* );
82 	DECL_LINK( ClickButton, Button* );
83 
84 	// helper functions
85 	void insertAllPPDValues( ListBox&, const psp::PPDParser*, const psp::PPDKey* );
86 public:
87 	RTSDialog( const ::psp::PrinterInfo& rJobData, const String& rPrinter, bool bAllPages, Window* pParent = NULL );
88 	~RTSDialog();
89 
90 	const ::psp::PrinterInfo& getSetup() const { return m_aJobData; }
91 };
92 
93 class RTSPaperPage : public TabPage
94 {
95 	RTSDialog*			m_pParent;
96 
97 	FixedText			m_aPaperText;
98 	ListBox				m_aPaperBox;
99 
100 	FixedText			m_aOrientText;
101 	ListBox				m_aOrientBox;
102 
103 	FixedText			m_aDuplexText;
104 	ListBox				m_aDuplexBox;
105 
106 	FixedText			m_aSlotText;
107 	ListBox				m_aSlotBox;
108 
109 	DECL_LINK( SelectHdl, ListBox* );
110 public:
111 	RTSPaperPage( RTSDialog* );
112 	~RTSPaperPage();
113 
114 	void update();
115 
116 	String getOrientation() { return m_aOrientBox.GetSelectEntry(); }
117 };
118 
119 class RTSDevicePage : public TabPage
120 {
121 	RTSDialog*			m_pParent;
122 
123 	String				m_aSpaceColor;
124 	String				m_aSpaceGray;
125 
126 	FixedText			m_aPPDKeyText;
127 	ListBox				m_aPPDKeyBox;
128 
129 	FixedText			m_aPPDValueText;
130 	ListBox				m_aPPDValueBox;
131 
132 	FixedText			m_aLevelText;
133 	ListBox				m_aLevelBox;
134 
135 	FixedText			m_aSpaceText;
136 	ListBox				m_aSpaceBox;
137 
138 	FixedText			m_aDepthText;
139 	ListBox				m_aDepthBox;
140 
141 	void FillValueBox( const ::psp::PPDKey* );
142 
143 	DECL_LINK( SelectHdl, ListBox* );
144 public:
145 	RTSDevicePage( RTSDialog* );
146 	~RTSDevicePage();
147 
148 	void update();
149 
150 	sal_uLong getLevel();
151 	sal_uLong getPDFDevice();
152 	sal_uLong getDepth() { return m_aDepthBox.GetSelectEntry().ToInt32(); }
153 	sal_uLong getColorDevice()
154 	{
155 		String aSpace( m_aSpaceBox.GetSelectEntry() );
156 		return aSpace == m_aSpaceColor ? 1 : ( aSpace == m_aSpaceGray ? -1 : 0 );
157 	}
158 };
159 
160 class RTSOtherPage : public TabPage
161 {
162 	RTSDialog*			m_pParent;
163 
164 	FixedText			m_aLeftTxt;
165 	MetricField			m_aLeftLB;
166 	FixedText			m_aTopTxt;
167 	MetricField			m_aTopLB;
168 	FixedText			m_aRightTxt;
169 	MetricField			m_aRightLB;
170 	FixedText			m_aBottomTxt;
171 	MetricField			m_aBottomLB;
172 	FixedText			m_aCommentTxt;
173 	Edit				m_aCommentEdt;
174 	PushButton			m_aDefaultBtn;
175 
176 	void initValues();
177 
178 	DECL_LINK( ClickBtnHdl, Button *);
179 
180 public:
181 	RTSOtherPage( RTSDialog* );
182 	~RTSOtherPage();
183 
184 	void save();
185 };
186 
187 class RTSFontSubstPage : public TabPage
188 {
189 	RTSDialog*			m_pParent;
190 
191 	FixedText			m_aSubstitutionsText;
192 	DelMultiListBox		m_aSubstitutionsBox;
193 	FixedText			m_aFromFontText;
194 	ComboBox			m_aFromFontBox;
195 	FixedText			m_aToFontText;
196 	ListBox				m_aToFontBox;
197 
198 	PushButton			m_aAddButton;
199 	PushButton			m_aRemoveButton;
200 	CheckBox			m_aEnableBox;
201 
202 	DECL_LINK( ClickBtnHdl, Button* );
203 	DECL_LINK( SelectHdl, ListBox* );
204 	DECL_LINK( DelPressedHdl, ListBox* );
205 
206 	void update();
207 public:
208 	RTSFontSubstPage( RTSDialog* );
209 	~RTSFontSubstPage();
210 };
211 
212 } // namespace
213 
214 #endif // _PAD_PRTSETUP_HXX
215