1*23e9c6caSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*23e9c6caSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*23e9c6caSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*23e9c6caSAndrew Rist * distributed with this work for additional information 6*23e9c6caSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*23e9c6caSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*23e9c6caSAndrew Rist * "License"); you may not use this file except in compliance 9*23e9c6caSAndrew Rist * with the License. You may obtain a copy of the License at 10*23e9c6caSAndrew Rist * 11*23e9c6caSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*23e9c6caSAndrew Rist * 13*23e9c6caSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*23e9c6caSAndrew Rist * software distributed under the License is distributed on an 15*23e9c6caSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*23e9c6caSAndrew Rist * KIND, either express or implied. See the License for the 17*23e9c6caSAndrew Rist * specific language governing permissions and limitations 18*23e9c6caSAndrew Rist * under the License. 19*23e9c6caSAndrew Rist * 20*23e9c6caSAndrew Rist *************************************************************/ 21*23e9c6caSAndrew Rist 22*23e9c6caSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _PAD_ADDDLG_HXX_ 25cdf0e10cSrcweir #define _PAD_ADDDLG_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "helper.hxx" 28cdf0e10cSrcweir #include "titlectrl.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include "vcl/dialog.hxx" 31cdf0e10cSrcweir #include "vcl/tabpage.hxx" 32cdf0e10cSrcweir #include "vcl/button.hxx" 33cdf0e10cSrcweir #include "vcl/fixed.hxx" 34cdf0e10cSrcweir #include "vcl/combobox.hxx" 35cdf0e10cSrcweir #include "vcl/printerinfomanager.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace padmin 38cdf0e10cSrcweir { 39cdf0e10cSrcweir 40cdf0e10cSrcweir class AddPrinterDialog; 41cdf0e10cSrcweir 42cdf0e10cSrcweir namespace DeviceKind { enum type { Printer, Fax, Pdf }; } 43cdf0e10cSrcweir 44cdf0e10cSrcweir class APTabPage : public TabPage 45cdf0e10cSrcweir { 46cdf0e10cSrcweir String m_aTitle; 47cdf0e10cSrcweir protected: 48cdf0e10cSrcweir AddPrinterDialog* m_pParent; 49cdf0e10cSrcweir public: 50cdf0e10cSrcweir APTabPage( AddPrinterDialog* pParent, const ResId& rResId ); 51cdf0e10cSrcweir 52cdf0e10cSrcweir // returns false if information is incomplete or invalid 53cdf0e10cSrcweir virtual bool check() = 0; 54cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ) = 0; getTitle() const55cdf0e10cSrcweir const String& getTitle() const { return m_aTitle; } 56cdf0e10cSrcweir }; 57cdf0e10cSrcweir 58cdf0e10cSrcweir class APChooseDevicePage : public APTabPage 59cdf0e10cSrcweir { 60cdf0e10cSrcweir RadioButton m_aPrinterBtn; 61cdf0e10cSrcweir RadioButton m_aFaxBtn; 62cdf0e10cSrcweir RadioButton m_aPDFBtn; 63cdf0e10cSrcweir RadioButton m_aOldBtn; 64cdf0e10cSrcweir FixedText m_aOverTxt; 65cdf0e10cSrcweir public: 66cdf0e10cSrcweir APChooseDevicePage( AddPrinterDialog* pParent ); 67cdf0e10cSrcweir ~APChooseDevicePage(); 68cdf0e10cSrcweir isPrinter()69cdf0e10cSrcweir bool isPrinter() { return m_aPrinterBtn.IsChecked(); } isFax()70cdf0e10cSrcweir bool isFax() { return m_aFaxBtn.IsChecked(); } isPDF()71cdf0e10cSrcweir bool isPDF() { return m_aPDFBtn.IsChecked(); } isOld()72cdf0e10cSrcweir bool isOld() { return m_aOldBtn.IsChecked(); } 73cdf0e10cSrcweir 74cdf0e10cSrcweir 75cdf0e10cSrcweir virtual bool check(); 76cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 77cdf0e10cSrcweir }; 78cdf0e10cSrcweir 79cdf0e10cSrcweir class APChooseDriverPage : public APTabPage 80cdf0e10cSrcweir { 81cdf0e10cSrcweir FixedText m_aDriverTxt; 82cdf0e10cSrcweir DelListBox m_aDriverBox; 83cdf0e10cSrcweir PushButton m_aAddBtn; 84cdf0e10cSrcweir PushButton m_aRemBtn; 85cdf0e10cSrcweir 86cdf0e10cSrcweir String m_aRemStr; 87cdf0e10cSrcweir String m_aLastPrinterName; 88cdf0e10cSrcweir 89cdf0e10cSrcweir DECL_LINK( ClickBtnHdl, PushButton* ); 90cdf0e10cSrcweir DECL_LINK( DelPressedHdl, ListBox* ); 91cdf0e10cSrcweir 92cdf0e10cSrcweir void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) ); 93cdf0e10cSrcweir public: 94cdf0e10cSrcweir APChooseDriverPage( AddPrinterDialog* pParent ); 95cdf0e10cSrcweir ~APChooseDriverPage(); 96cdf0e10cSrcweir 97cdf0e10cSrcweir virtual bool check(); 98cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 99cdf0e10cSrcweir }; 100cdf0e10cSrcweir 101cdf0e10cSrcweir class APNamePage : public APTabPage 102cdf0e10cSrcweir { 103cdf0e10cSrcweir FixedText m_aNameTxt; 104cdf0e10cSrcweir Edit m_aNameEdt; 105cdf0e10cSrcweir CheckBox m_aDefaultBox; 106cdf0e10cSrcweir CheckBox m_aFaxSwallowBox; 107cdf0e10cSrcweir public: 108cdf0e10cSrcweir APNamePage( AddPrinterDialog* pParent, const String& rInitName, DeviceKind::type eKind ); 109cdf0e10cSrcweir ~APNamePage(); 110cdf0e10cSrcweir isDefault()111cdf0e10cSrcweir bool isDefault() { return m_aDefaultBox.IsChecked(); } isFaxSwallow()112cdf0e10cSrcweir bool isFaxSwallow() { return m_aFaxSwallowBox.IsChecked(); } 113cdf0e10cSrcweir setText(const String & rText)114cdf0e10cSrcweir void setText( const String& rText ) { m_aNameEdt.SetText( rText ); } 115cdf0e10cSrcweir 116cdf0e10cSrcweir virtual bool check(); 117cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 118cdf0e10cSrcweir }; 119cdf0e10cSrcweir 120cdf0e10cSrcweir class APCommandPage : public APTabPage 121cdf0e10cSrcweir { 122cdf0e10cSrcweir FixedText m_aCommandTxt; 123cdf0e10cSrcweir ComboBox m_aCommandBox; 124cdf0e10cSrcweir PushButton m_aHelpBtn; 125cdf0e10cSrcweir String m_aHelpTxt; 126cdf0e10cSrcweir FixedText m_aPdfDirTxt; 127cdf0e10cSrcweir Edit m_aPdfDirEdt; 128cdf0e10cSrcweir PushButton m_aPdfDirBtn; 129cdf0e10cSrcweir 130cdf0e10cSrcweir DeviceKind::type m_eKind; 131cdf0e10cSrcweir 132cdf0e10cSrcweir DECL_LINK( ClickBtnHdl, PushButton* ); 133cdf0e10cSrcweir DECL_LINK( ModifyHdl, ComboBox* ); 134cdf0e10cSrcweir public: 135cdf0e10cSrcweir 136cdf0e10cSrcweir APCommandPage( AddPrinterDialog* pParent, DeviceKind::type eKind ); 137cdf0e10cSrcweir ~APCommandPage(); 138cdf0e10cSrcweir 139cdf0e10cSrcweir virtual bool check(); 140cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 141cdf0e10cSrcweir getPdfDir()142cdf0e10cSrcweir String getPdfDir() { return m_aPdfDirEdt.GetText(); } 143cdf0e10cSrcweir }; 144cdf0e10cSrcweir 145cdf0e10cSrcweir class APOldPrinterPage : public APTabPage 146cdf0e10cSrcweir { 147cdf0e10cSrcweir FixedText m_aOldPrinterTxt; 148cdf0e10cSrcweir MultiListBox m_aOldPrinterBox; 149cdf0e10cSrcweir PushButton m_aSelectAllBtn; 150cdf0e10cSrcweir 151cdf0e10cSrcweir ::std::list< ::psp::PrinterInfo > m_aOldPrinters; 152cdf0e10cSrcweir 153cdf0e10cSrcweir DECL_LINK( ClickBtnHdl, PushButton* ); 154cdf0e10cSrcweir public: 155cdf0e10cSrcweir APOldPrinterPage( AddPrinterDialog* pParent ); 156cdf0e10cSrcweir ~APOldPrinterPage(); 157cdf0e10cSrcweir 158cdf0e10cSrcweir virtual bool check(); 159cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 160cdf0e10cSrcweir 161cdf0e10cSrcweir void addOldPrinters(); 162cdf0e10cSrcweir }; 163cdf0e10cSrcweir 164cdf0e10cSrcweir class APFaxDriverPage : public APTabPage 165cdf0e10cSrcweir { 166cdf0e10cSrcweir FixedText m_aFaxTxt; 167cdf0e10cSrcweir RadioButton m_aDefBtn; 168cdf0e10cSrcweir RadioButton m_aSelectBtn; 169cdf0e10cSrcweir public: 170cdf0e10cSrcweir APFaxDriverPage( AddPrinterDialog* pParent ); 171cdf0e10cSrcweir ~APFaxDriverPage(); 172cdf0e10cSrcweir 173cdf0e10cSrcweir virtual bool check(); 174cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 175cdf0e10cSrcweir isDefault()176cdf0e10cSrcweir bool isDefault() { return m_aDefBtn.IsChecked(); } 177cdf0e10cSrcweir }; 178cdf0e10cSrcweir 179cdf0e10cSrcweir class APPdfDriverPage : public APTabPage 180cdf0e10cSrcweir { 181cdf0e10cSrcweir FixedText m_aPdfTxt; 182cdf0e10cSrcweir RadioButton m_aDefBtn; 183cdf0e10cSrcweir RadioButton m_aDistBtn; 184cdf0e10cSrcweir RadioButton m_aSelectBtn; 185cdf0e10cSrcweir public: 186cdf0e10cSrcweir APPdfDriverPage( AddPrinterDialog* pParent ); 187cdf0e10cSrcweir ~APPdfDriverPage(); 188cdf0e10cSrcweir 189cdf0e10cSrcweir virtual bool check(); 190cdf0e10cSrcweir virtual void fill( ::psp::PrinterInfo& rInfo ); 191cdf0e10cSrcweir isDefault()192cdf0e10cSrcweir bool isDefault() { return m_aDefBtn.IsChecked(); } isDist()193cdf0e10cSrcweir bool isDist() { return m_aDistBtn.IsChecked(); } 194cdf0e10cSrcweir }; 195cdf0e10cSrcweir 196cdf0e10cSrcweir class AddPrinterDialog : public ModalDialog 197cdf0e10cSrcweir { 198cdf0e10cSrcweir CancelButton m_aCancelPB; 199cdf0e10cSrcweir PushButton m_aPrevPB; 200cdf0e10cSrcweir PushButton m_aNextPB; 201cdf0e10cSrcweir OKButton m_aFinishPB; 202cdf0e10cSrcweir FixedLine m_aLine; 203cdf0e10cSrcweir TitleImage m_aTitleImage; 204cdf0e10cSrcweir 205cdf0e10cSrcweir ::psp::PrinterInfo m_aPrinter; 206cdf0e10cSrcweir 207cdf0e10cSrcweir APTabPage* m_pCurrentPage; 208cdf0e10cSrcweir 209cdf0e10cSrcweir APChooseDevicePage* m_pChooseDevicePage; 210cdf0e10cSrcweir APCommandPage* m_pCommandPage; 211cdf0e10cSrcweir APChooseDriverPage* m_pChooseDriverPage; 212cdf0e10cSrcweir APNamePage* m_pNamePage; 213cdf0e10cSrcweir APOldPrinterPage* m_pOldPrinterPage; 214cdf0e10cSrcweir APFaxDriverPage* m_pFaxDriverPage; 215cdf0e10cSrcweir APChooseDriverPage* m_pFaxSelectDriverPage; 216cdf0e10cSrcweir APNamePage* m_pFaxNamePage; 217cdf0e10cSrcweir APCommandPage* m_pFaxCommandPage; 218cdf0e10cSrcweir APPdfDriverPage* m_pPdfDriverPage; 219cdf0e10cSrcweir APChooseDriverPage* m_pPdfSelectDriverPage; 220cdf0e10cSrcweir APNamePage* m_pPdfNamePage; 221cdf0e10cSrcweir APCommandPage* m_pPdfCommandPage; 222cdf0e10cSrcweir 223cdf0e10cSrcweir DECL_LINK( ClickBtnHdl, PushButton* ); 224cdf0e10cSrcweir 225cdf0e10cSrcweir void advance(); 226cdf0e10cSrcweir void back(); 227cdf0e10cSrcweir void addPrinter(); 228cdf0e10cSrcweir 229cdf0e10cSrcweir void updateSettings(); 230cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rEv ); 231cdf0e10cSrcweir 232cdf0e10cSrcweir public: 233cdf0e10cSrcweir AddPrinterDialog( Window* pParent ); 234cdf0e10cSrcweir ~AddPrinterDialog(); 235cdf0e10cSrcweir 236cdf0e10cSrcweir static String uniquePrinterName( const String& rString ); 237cdf0e10cSrcweir static String getOldPrinterLocation(); 238cdf0e10cSrcweir enableNext(bool bEnable)239cdf0e10cSrcweir void enableNext( bool bEnable ) { m_aNextPB.Enable( bEnable ); } 240cdf0e10cSrcweir }; 241cdf0e10cSrcweir 242cdf0e10cSrcweir } // namespace 243cdf0e10cSrcweir 244cdf0e10cSrcweir #endif 245