1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_
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"
36 class AddPrinterDialog
;
38 namespace DeviceKind
{ enum type
{ Printer
, Fax
, Pdf
}; }
40 class APTabPage
: public TabPage
44 AddPrinterDialog
* m_pParent
;
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
;
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(); }
72 virtual void fill( ::psp::PrinterInfo
& rInfo
);
75 class APChooseDriverPage
: public APTabPage
77 FixedText m_aDriverTxt
;
78 DelListBox m_aDriverBox
;
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" ) ) );
90 APChooseDriverPage( AddPrinterDialog
* pParent
);
91 ~APChooseDriverPage();
94 virtual void fill( ::psp::PrinterInfo
& rInfo
);
97 class APNamePage
: public APTabPage
101 CheckBox m_aDefaultBox
;
102 CheckBox m_aFaxSwallowBox
;
104 APNamePage( AddPrinterDialog
* pParent
, const String
& rInitName
, DeviceKind::type eKind
);
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
;
122 FixedText m_aPdfDirTxt
;
124 PushButton m_aPdfDirBtn
;
126 DeviceKind::type m_eKind
;
128 DECL_LINK( ClickBtnHdl
, PushButton
* );
129 DECL_LINK( ModifyHdl
, ComboBox
* );
132 APCommandPage( AddPrinterDialog
* pParent
, DeviceKind::type eKind
);
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
* );
151 APOldPrinterPage( AddPrinterDialog
* pParent
);
154 virtual bool check();
155 virtual void fill( ::psp::PrinterInfo
& rInfo
);
157 void addOldPrinters();
160 class APFaxDriverPage
: public APTabPage
163 RadioButton m_aDefBtn
;
164 RadioButton m_aSelectBtn
;
166 APFaxDriverPage( AddPrinterDialog
* pParent
);
169 virtual bool check();
170 virtual void fill( ::psp::PrinterInfo
& rInfo
);
172 bool isDefault() { return m_aDefBtn
.IsChecked(); }
175 class APPdfDriverPage
: public APTabPage
178 RadioButton m_aDefBtn
;
179 RadioButton m_aDistBtn
;
180 RadioButton m_aSelectBtn
;
182 APPdfDriverPage( AddPrinterDialog
* pParent
);
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
;
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
* );
225 void updateSettings();
226 virtual void DataChanged( const DataChangedEvent
& rEv
);
229 AddPrinterDialog( Window
* pParent
);
232 static String
uniquePrinterName( const String
& rString
);
233 static String
getOldPrinterLocation();
235 void enableNext( bool bEnable
) { m_aNextPB
.Enable( bEnable
); }
242 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */