merge the formfield patch from ooo-build
[ooovba.git] / padmin / source / adddlg.hxx
blob1924622840b8c21d9b982f4366196676c83cc19e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: adddlg.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _PAD_ADDDLG_HXX_
32 #define _PAD_ADDDLG_HXX_
34 #include "helper.hxx"
35 #include "titlectrl.hxx"
37 #include "vcl/dialog.hxx"
38 #include "vcl/tabpage.hxx"
39 #include "vcl/button.hxx"
40 #include "vcl/fixed.hxx"
41 #include "vcl/combobox.hxx"
42 #include "vcl/printerinfomanager.hxx"
44 namespace padmin
47 class AddPrinterDialog;
49 namespace DeviceKind { enum type { Printer, Fax, Pdf }; }
51 class APTabPage : public TabPage
53 String m_aTitle;
54 protected:
55 AddPrinterDialog* m_pParent;
56 public:
57 APTabPage( AddPrinterDialog* pParent, const ResId& rResId );
59 // returns false if information is incomplete or invalid
60 virtual bool check() = 0;
61 virtual void fill( ::psp::PrinterInfo& rInfo ) = 0;
62 const String& getTitle() const { return m_aTitle; }
65 class APChooseDevicePage : public APTabPage
67 RadioButton m_aPrinterBtn;
68 RadioButton m_aFaxBtn;
69 RadioButton m_aPDFBtn;
70 RadioButton m_aOldBtn;
71 FixedText m_aOverTxt;
72 public:
73 APChooseDevicePage( AddPrinterDialog* pParent );
74 ~APChooseDevicePage();
76 bool isPrinter() { return m_aPrinterBtn.IsChecked(); }
77 bool isFax() { return m_aFaxBtn.IsChecked(); }
78 bool isPDF() { return m_aPDFBtn.IsChecked(); }
79 bool isOld() { return m_aOldBtn.IsChecked(); }
82 virtual bool check();
83 virtual void fill( ::psp::PrinterInfo& rInfo );
86 class APChooseDriverPage : public APTabPage
88 FixedText m_aDriverTxt;
89 DelListBox m_aDriverBox;
90 PushButton m_aAddBtn;
91 PushButton m_aRemBtn;
93 String m_aRemStr;
94 String m_aLastPrinterName;
96 DECL_LINK( ClickBtnHdl, PushButton* );
97 DECL_LINK( DelPressedHdl, ListBox* );
99 void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) );
100 public:
101 APChooseDriverPage( AddPrinterDialog* pParent );
102 ~APChooseDriverPage();
104 virtual bool check();
105 virtual void fill( ::psp::PrinterInfo& rInfo );
108 class APNamePage : public APTabPage
110 FixedText m_aNameTxt;
111 Edit m_aNameEdt;
112 CheckBox m_aDefaultBox;
113 CheckBox m_aFaxSwallowBox;
114 public:
115 APNamePage( AddPrinterDialog* pParent, const String& rInitName, DeviceKind::type eKind );
116 ~APNamePage();
118 bool isDefault() { return m_aDefaultBox.IsChecked(); }
119 bool isFaxSwallow() { return m_aFaxSwallowBox.IsChecked(); }
121 void setText( const String& rText ) { m_aNameEdt.SetText( rText ); }
123 virtual bool check();
124 virtual void fill( ::psp::PrinterInfo& rInfo );
127 class APCommandPage : public APTabPage
129 FixedText m_aCommandTxt;
130 ComboBox m_aCommandBox;
131 PushButton m_aHelpBtn;
132 String m_aHelpTxt;
133 FixedText m_aPdfDirTxt;
134 Edit m_aPdfDirEdt;
135 PushButton m_aPdfDirBtn;
137 DeviceKind::type m_eKind;
139 DECL_LINK( ClickBtnHdl, PushButton* );
140 DECL_LINK( ModifyHdl, ComboBox* );
141 public:
143 APCommandPage( AddPrinterDialog* pParent, DeviceKind::type eKind );
144 ~APCommandPage();
146 virtual bool check();
147 virtual void fill( ::psp::PrinterInfo& rInfo );
149 String getPdfDir() { return m_aPdfDirEdt.GetText(); }
152 class APOldPrinterPage : public APTabPage
154 FixedText m_aOldPrinterTxt;
155 MultiListBox m_aOldPrinterBox;
156 PushButton m_aSelectAllBtn;
158 ::std::list< ::psp::PrinterInfo > m_aOldPrinters;
160 DECL_LINK( ClickBtnHdl, PushButton* );
161 public:
162 APOldPrinterPage( AddPrinterDialog* pParent );
163 ~APOldPrinterPage();
165 virtual bool check();
166 virtual void fill( ::psp::PrinterInfo& rInfo );
168 void addOldPrinters();
171 class APFaxDriverPage : public APTabPage
173 FixedText m_aFaxTxt;
174 RadioButton m_aDefBtn;
175 RadioButton m_aSelectBtn;
176 public:
177 APFaxDriverPage( AddPrinterDialog* pParent );
178 ~APFaxDriverPage();
180 virtual bool check();
181 virtual void fill( ::psp::PrinterInfo& rInfo );
183 bool isDefault() { return m_aDefBtn.IsChecked(); }
186 class APPdfDriverPage : public APTabPage
188 FixedText m_aPdfTxt;
189 RadioButton m_aDefBtn;
190 RadioButton m_aDistBtn;
191 RadioButton m_aSelectBtn;
192 public:
193 APPdfDriverPage( AddPrinterDialog* pParent );
194 ~APPdfDriverPage();
196 virtual bool check();
197 virtual void fill( ::psp::PrinterInfo& rInfo );
199 bool isDefault() { return m_aDefBtn.IsChecked(); }
200 bool isDist() { return m_aDistBtn.IsChecked(); }
203 class AddPrinterDialog : public ModalDialog
205 CancelButton m_aCancelPB;
206 PushButton m_aPrevPB;
207 PushButton m_aNextPB;
208 OKButton m_aFinishPB;
209 FixedLine m_aLine;
210 TitleImage m_aTitleImage;
212 ::psp::PrinterInfo m_aPrinter;
214 APTabPage* m_pCurrentPage;
216 APChooseDevicePage* m_pChooseDevicePage;
217 APCommandPage* m_pCommandPage;
218 APChooseDriverPage* m_pChooseDriverPage;
219 APNamePage* m_pNamePage;
220 APOldPrinterPage* m_pOldPrinterPage;
221 APFaxDriverPage* m_pFaxDriverPage;
222 APChooseDriverPage* m_pFaxSelectDriverPage;
223 APNamePage* m_pFaxNamePage;
224 APCommandPage* m_pFaxCommandPage;
225 APPdfDriverPage* m_pPdfDriverPage;
226 APChooseDriverPage* m_pPdfSelectDriverPage;
227 APNamePage* m_pPdfNamePage;
228 APCommandPage* m_pPdfCommandPage;
230 DECL_LINK( ClickBtnHdl, PushButton* );
232 void advance();
233 void back();
234 void addPrinter();
236 void updateSettings();
237 virtual void DataChanged( const DataChangedEvent& rEv );
239 public:
240 AddPrinterDialog( Window* pParent );
241 ~AddPrinterDialog();
243 static String uniquePrinterName( const String& rString );
244 static String getOldPrinterLocation();
246 void enableNext( bool bEnable ) { m_aNextPB.Enable( bEnable ); }
249 } // namespace
251 #endif