LCOV - code coverage report
Current view: top level - libreoffice/padmin/source - adddlg.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 14 0.0 %
Date: 2012-12-27 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef _PAD_ADDDLG_HXX_
      21             : #define _PAD_ADDDLG_HXX_
      22             : 
      23             : #include "helper.hxx"
      24             : #include "titlectrl.hxx"
      25             : 
      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"
      32             : 
      33             : namespace padmin
      34             : {
      35             : 
      36             : class AddPrinterDialog;
      37             : 
      38             : namespace DeviceKind { enum type { Printer, Fax, Pdf }; }
      39             : 
      40           0 : class APTabPage : public TabPage
      41             : {
      42             :     String              m_aTitle;
      43             : protected:
      44             :     AddPrinterDialog*   m_pParent;
      45             : public:
      46             :     APTabPage( AddPrinterDialog* pParent, const ResId& rResId );
      47             : 
      48             :     // returns false if information is incomplete or invalid
      49             :     virtual bool check() = 0;
      50             :     virtual void fill( ::psp::PrinterInfo& rInfo ) = 0;
      51           0 :     const String& getTitle() const { return m_aTitle; }
      52             : };
      53             : 
      54             : class APChooseDevicePage : public APTabPage
      55             : {
      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();
      64             : 
      65           0 :     bool isPrinter() { return m_aPrinterBtn.IsChecked(); }
      66           0 :     bool isFax() { return m_aFaxBtn.IsChecked(); }
      67           0 :     bool isPDF() { return m_aPDFBtn.IsChecked(); }
      68           0 :     bool isOld() { return m_aOldBtn.IsChecked(); }
      69             : 
      70             : 
      71             :     virtual bool check();
      72             :     virtual void fill( ::psp::PrinterInfo& rInfo );
      73             : };
      74             : 
      75             : class APChooseDriverPage : public APTabPage
      76             : {
      77             :     FixedText               m_aDriverTxt;
      78             :     DelListBox              m_aDriverBox;
      79             :     PushButton              m_aAddBtn;
      80             :     PushButton              m_aRemBtn;
      81             : 
      82             :     String                  m_aRemStr;
      83             :     String                  m_aLastPrinterName;
      84             : 
      85             :     DECL_LINK( ClickBtnHdl, PushButton* );
      86             :     DECL_LINK( DelPressedHdl, ListBox* );
      87             : 
      88             :     void updateDrivers( bool bRefresh = false, const rtl::OUString& rSelectDriver = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SGENPRT" ) ) );
      89             : public:
      90             :     APChooseDriverPage( AddPrinterDialog* pParent );
      91             :     ~APChooseDriverPage();
      92             : 
      93             :     virtual bool check();
      94             :     virtual void fill( ::psp::PrinterInfo& rInfo );
      95             : };
      96             : 
      97             : class APNamePage : public APTabPage
      98             : {
      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();
     106             : 
     107           0 :     bool isDefault() { return m_aDefaultBox.IsChecked(); }
     108           0 :     bool isFaxSwallow() { return m_aFaxSwallowBox.IsChecked(); }
     109             : 
     110           0 :     void setText( const String& rText ) { m_aNameEdt.SetText( rText ); }
     111             : 
     112             :     virtual bool check();
     113             :     virtual void fill( ::psp::PrinterInfo& rInfo );
     114             : };
     115             : 
     116             : class APCommandPage : public APTabPage
     117             : {
     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;
     125             : 
     126             :     DeviceKind::type        m_eKind;
     127             : 
     128             :     DECL_LINK( ClickBtnHdl, PushButton* );
     129             :     DECL_LINK( ModifyHdl, ComboBox* );
     130             : public:
     131             : 
     132             :     APCommandPage( AddPrinterDialog* pParent, DeviceKind::type eKind );
     133             :     ~APCommandPage();
     134             : 
     135             :     virtual bool check();
     136             :     virtual void fill( ::psp::PrinterInfo& rInfo );
     137             : 
     138           0 :     String getPdfDir() { return m_aPdfDirEdt.GetText(); }
     139             : };
     140             : 
     141             : class APOldPrinterPage : public APTabPage
     142             : {
     143             :     FixedText                           m_aOldPrinterTxt;
     144             :     MultiListBox                        m_aOldPrinterBox;
     145             :     PushButton                          m_aSelectAllBtn;
     146             : 
     147             :     ::std::list< ::psp::PrinterInfo >   m_aOldPrinters;
     148             : 
     149             :     DECL_LINK( ClickBtnHdl, PushButton* );
     150             : public:
     151             :     APOldPrinterPage( AddPrinterDialog* pParent );
     152             :     ~APOldPrinterPage();
     153             : 
     154             :     virtual bool check();
     155             :     virtual void fill( ::psp::PrinterInfo& rInfo );
     156             : 
     157             :     void addOldPrinters();
     158             : };
     159             : 
     160             : class APFaxDriverPage : public APTabPage
     161             : {
     162             :     FixedText               m_aFaxTxt;
     163             :     RadioButton             m_aDefBtn;
     164             :     RadioButton             m_aSelectBtn;
     165             : public:
     166             :     APFaxDriverPage( AddPrinterDialog* pParent );
     167             :     ~APFaxDriverPage();
     168             : 
     169             :     virtual bool check();
     170             :     virtual void fill( ::psp::PrinterInfo& rInfo );
     171             : 
     172           0 :     bool isDefault() { return m_aDefBtn.IsChecked(); }
     173             : };
     174             : 
     175             : class APPdfDriverPage : public APTabPage
     176             : {
     177             :     FixedText               m_aPdfTxt;
     178             :     RadioButton             m_aDefBtn;
     179             :     RadioButton             m_aDistBtn;
     180             :     RadioButton             m_aSelectBtn;
     181             : public:
     182             :     APPdfDriverPage( AddPrinterDialog* pParent );
     183             :     ~APPdfDriverPage();
     184             : 
     185             :     virtual bool check();
     186             :     virtual void fill( ::psp::PrinterInfo& rInfo );
     187             : 
     188           0 :     bool isDefault() { return m_aDefBtn.IsChecked(); }
     189           0 :     bool isDist() { return m_aDistBtn.IsChecked(); }
     190             : };
     191             : 
     192             : class AddPrinterDialog : public ModalDialog
     193             : {
     194             :     CancelButton            m_aCancelPB;
     195             :     PushButton              m_aPrevPB;
     196             :     PushButton              m_aNextPB;
     197             :     OKButton                m_aFinishPB;
     198             :     FixedLine               m_aLine;
     199             :     TitleImage              m_aTitleImage;
     200             : 
     201             :     ::psp::PrinterInfo      m_aPrinter;
     202             : 
     203             :     APTabPage*              m_pCurrentPage;
     204             : 
     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;
     218             : 
     219             :     DECL_LINK( ClickBtnHdl, PushButton* );
     220             : 
     221             :     void advance();
     222             :     void back();
     223             :     void addPrinter();
     224             : 
     225             :     void updateSettings();
     226             :     virtual void DataChanged( const DataChangedEvent& rEv );
     227             : 
     228             : public:
     229             :     AddPrinterDialog( Window* pParent );
     230             :     ~AddPrinterDialog();
     231             : 
     232             :     static String uniquePrinterName( const String& rString );
     233             :     static String getOldPrinterLocation();
     234             : 
     235           0 :     void enableNext( bool bEnable ) { m_aNextPB.Enable( bEnable ); }
     236             : };
     237             : 
     238             : } // namespace
     239             : 
     240             : #endif
     241             : 
     242             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10