Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / padmin / source / adddlg.hxx
blobab55bb19962c93cb4fcf41d1cd059e87dd822a3f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _PAD_ADDDLG_HXX_
21 #define _PAD_ADDDLG_HXX_
23 #include "helper.hxx"
24 #include "titlectrl.hxx"
26 #include "vcl/dialog.hxx"
27 #include "vcl/tabpage.hxx"
28 #include "vcl/button.hxx"
29 #include "vcl/fixed.hxx"
30 #include "vcl/combobox.hxx"
31 #include "vcl/printerinfomanager.hxx"
33 namespace padmin
36 class AddPrinterDialog;
38 namespace DeviceKind { enum type { Printer, Fax, Pdf }; }
40 class APTabPage : public TabPage
42 String m_aTitle;
43 protected:
44 AddPrinterDialog* m_pParent;
45 public:
46 APTabPage( AddPrinterDialog* pParent, const ResId& rResId );
48 // returns false if information is incomplete or invalid
49 virtual bool check() = 0;
50 virtual void fill( ::psp::PrinterInfo& rInfo ) = 0;
51 const String& getTitle() const { return m_aTitle; }
54 class APChooseDevicePage : public APTabPage
56 RadioButton m_aPrinterBtn;
57 RadioButton m_aFaxBtn;
58 RadioButton m_aPDFBtn;
59 RadioButton m_aOldBtn;
60 FixedText m_aOverTxt;
61 public:
62 APChooseDevicePage( AddPrinterDialog* pParent );
63 ~APChooseDevicePage();
65 bool isPrinter() { return m_aPrinterBtn.IsChecked(); }
66 bool isFax() { return m_aFaxBtn.IsChecked(); }
67 bool isPDF() { return m_aPDFBtn.IsChecked(); }
68 bool isOld() { return m_aOldBtn.IsChecked(); }
71 virtual bool check();
72 virtual void fill( ::psp::PrinterInfo& rInfo );
75 class APChooseDriverPage : public APTabPage
77 FixedText m_aDriverTxt;
78 DelListBox m_aDriverBox;
79 PushButton m_aAddBtn;
80 PushButton m_aRemBtn;
82 String m_aRemStr;
83 String m_aLastPrinterName;
85 DECL_LINK( ClickBtnHdl, PushButton* );
86 DECL_LINK( DelPressedHdl, ListBox* );
88 void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) );
89 public:
90 APChooseDriverPage( AddPrinterDialog* pParent );
91 ~APChooseDriverPage();
93 virtual bool check();
94 virtual void fill( ::psp::PrinterInfo& rInfo );
97 class APNamePage : public APTabPage
99 FixedText m_aNameTxt;
100 Edit m_aNameEdt;
101 CheckBox m_aDefaultBox;
102 CheckBox m_aFaxSwallowBox;
103 public:
104 APNamePage( AddPrinterDialog* pParent, const String& rInitName, DeviceKind::type eKind );
105 ~APNamePage();
107 bool isDefault() { return m_aDefaultBox.IsChecked(); }
108 bool isFaxSwallow() { return m_aFaxSwallowBox.IsChecked(); }
110 void setText( const String& rText ) { m_aNameEdt.SetText( rText ); }
112 virtual bool check();
113 virtual void fill( ::psp::PrinterInfo& rInfo );
116 class APCommandPage : public APTabPage
118 FixedText m_aCommandTxt;
119 ComboBox m_aCommandBox;
120 PushButton m_aHelpBtn;
121 String m_aHelpTxt;
122 FixedText m_aPdfDirTxt;
123 Edit m_aPdfDirEdt;
124 PushButton m_aPdfDirBtn;
126 DeviceKind::type m_eKind;
128 DECL_LINK( ClickBtnHdl, PushButton* );
129 DECL_LINK( ModifyHdl, ComboBox* );
130 public:
132 APCommandPage( AddPrinterDialog* pParent, DeviceKind::type eKind );
133 ~APCommandPage();
135 virtual bool check();
136 virtual void fill( ::psp::PrinterInfo& rInfo );
138 String getPdfDir() { return m_aPdfDirEdt.GetText(); }
141 class APOldPrinterPage : public APTabPage
143 FixedText m_aOldPrinterTxt;
144 MultiListBox m_aOldPrinterBox;
145 PushButton m_aSelectAllBtn;
147 ::std::list< ::psp::PrinterInfo > m_aOldPrinters;
149 DECL_LINK( ClickBtnHdl, PushButton* );
150 public:
151 APOldPrinterPage( AddPrinterDialog* pParent );
152 ~APOldPrinterPage();
154 virtual bool check();
155 virtual void fill( ::psp::PrinterInfo& rInfo );
157 void addOldPrinters();
160 class APFaxDriverPage : public APTabPage
162 FixedText m_aFaxTxt;
163 RadioButton m_aDefBtn;
164 RadioButton m_aSelectBtn;
165 public:
166 APFaxDriverPage( AddPrinterDialog* pParent );
167 ~APFaxDriverPage();
169 virtual bool check();
170 virtual void fill( ::psp::PrinterInfo& rInfo );
172 bool isDefault() { return m_aDefBtn.IsChecked(); }
175 class APPdfDriverPage : public APTabPage
177 FixedText m_aPdfTxt;
178 RadioButton m_aDefBtn;
179 RadioButton m_aDistBtn;
180 RadioButton m_aSelectBtn;
181 public:
182 APPdfDriverPage( AddPrinterDialog* pParent );
183 ~APPdfDriverPage();
185 virtual bool check();
186 virtual void fill( ::psp::PrinterInfo& rInfo );
188 bool isDefault() { return m_aDefBtn.IsChecked(); }
189 bool isDist() { return m_aDistBtn.IsChecked(); }
192 class AddPrinterDialog : public ModalDialog
194 CancelButton m_aCancelPB;
195 PushButton m_aPrevPB;
196 PushButton m_aNextPB;
197 OKButton m_aFinishPB;
198 FixedLine m_aLine;
199 TitleImage m_aTitleImage;
201 ::psp::PrinterInfo m_aPrinter;
203 APTabPage* m_pCurrentPage;
205 APChooseDevicePage* m_pChooseDevicePage;
206 APCommandPage* m_pCommandPage;
207 APChooseDriverPage* m_pChooseDriverPage;
208 APNamePage* m_pNamePage;
209 APOldPrinterPage* m_pOldPrinterPage;
210 APFaxDriverPage* m_pFaxDriverPage;
211 APChooseDriverPage* m_pFaxSelectDriverPage;
212 APNamePage* m_pFaxNamePage;
213 APCommandPage* m_pFaxCommandPage;
214 APPdfDriverPage* m_pPdfDriverPage;
215 APChooseDriverPage* m_pPdfSelectDriverPage;
216 APNamePage* m_pPdfNamePage;
217 APCommandPage* m_pPdfCommandPage;
219 DECL_LINK( ClickBtnHdl, PushButton* );
221 void advance();
222 void back();
223 void addPrinter();
225 void updateSettings();
226 virtual void DataChanged( const DataChangedEvent& rEv );
228 public:
229 AddPrinterDialog( Window* pParent );
230 ~AddPrinterDialog();
232 static String uniquePrinterName( const String& rString );
233 static String getOldPrinterLocation();
235 void enableNext( bool bEnable ) { m_aNextPB.Enable( bEnable ); }
238 } // namespace
240 #endif
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */