1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 30*cdf0e10cSrcweir #include <tools/debug.hxx> 31*cdf0e10cSrcweir #ifndef _VCL_PRINT_HXX 32*cdf0e10cSrcweir #include <vcl/print.hxx> 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #ifndef GCC 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #include <svtools/svtdata.hxx> 39*cdf0e10cSrcweir #include "prnsetup.hrc" 40*cdf0e10cSrcweir #include <svtools/prnsetup.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir // ======================================================================= 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir void ImplFillPrnDlgListBox( const Printer* pPrinter, 45*cdf0e10cSrcweir ListBox* pBox, PushButton* pPropBtn ) 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir ImplFreePrnDlgListBox( pBox ); 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir const std::vector<rtl::OUString>& rPrinters = Printer::GetPrinterQueues(); 50*cdf0e10cSrcweir unsigned int nCount = rPrinters.size(); 51*cdf0e10cSrcweir if ( nCount ) 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir for( unsigned int i = 0; i < nCount; i++ ) 54*cdf0e10cSrcweir pBox->InsertEntry( rPrinters[i] ); 55*cdf0e10cSrcweir pBox->SelectEntry( pPrinter->GetName() ); 56*cdf0e10cSrcweir } 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir pBox->Enable( nCount != 0 ); 59*cdf0e10cSrcweir pPropBtn->Show( pPrinter->HasSupport( SUPPORT_SETUPDIALOG ) ); 60*cdf0e10cSrcweir } 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir // ----------------------------------------------------------------------- 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir void ImplFreePrnDlgListBox( ListBox* pBox, sal_Bool bClear ) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir if ( bClear ) 67*cdf0e10cSrcweir pBox->Clear(); 68*cdf0e10cSrcweir } 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir // ----------------------------------------------------------------------- 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir Printer* ImplPrnDlgListBoxSelect( ListBox* pBox, PushButton* pPropBtn, 73*cdf0e10cSrcweir Printer* pPrinter, Printer* pTempPrinter ) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir if ( pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), true ); 78*cdf0e10cSrcweir if( pInfo) 79*cdf0e10cSrcweir { 80*cdf0e10cSrcweir if ( !pTempPrinter ) 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir if ( (pPrinter->GetName() == pInfo->GetPrinterName()) && 83*cdf0e10cSrcweir (pPrinter->GetDriverName() == pInfo->GetDriver()) ) 84*cdf0e10cSrcweir pTempPrinter = new Printer( pPrinter->GetJobSetup() ); 85*cdf0e10cSrcweir else 86*cdf0e10cSrcweir pTempPrinter = new Printer( *pInfo ); 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir else 89*cdf0e10cSrcweir { 90*cdf0e10cSrcweir if ( (pTempPrinter->GetName() != pInfo->GetPrinterName()) || 91*cdf0e10cSrcweir (pTempPrinter->GetDriverName() != pInfo->GetDriver()) ) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir delete pTempPrinter; 94*cdf0e10cSrcweir pTempPrinter = new Printer( *pInfo ); 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir } 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir pPropBtn->Enable( pTempPrinter->HasSupport( SUPPORT_SETUPDIALOG ) ); 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir else 101*cdf0e10cSrcweir pPropBtn->Disable(); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir else 104*cdf0e10cSrcweir pPropBtn->Disable(); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir return pTempPrinter; 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir // ----------------------------------------------------------------------- 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir Printer* ImplPrnDlgUpdatePrinter( Printer* pPrinter, Printer* pTempPrinter ) 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir XubString aPrnName; 114*cdf0e10cSrcweir if ( pTempPrinter ) 115*cdf0e10cSrcweir aPrnName = pTempPrinter->GetName(); 116*cdf0e10cSrcweir else 117*cdf0e10cSrcweir aPrnName = pPrinter->GetName(); 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir if ( ! Printer::GetQueueInfo( aPrnName, false ) ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir if ( pTempPrinter ) 122*cdf0e10cSrcweir delete pTempPrinter; 123*cdf0e10cSrcweir pTempPrinter = new Printer; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir return pTempPrinter; 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir // ----------------------------------------------------------------------- 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir void ImplPrnDlgUpdateQueueInfo( ListBox* pBox, QueueInfo& rInfo ) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir if ( pBox->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) 134*cdf0e10cSrcweir { 135*cdf0e10cSrcweir const QueueInfo* pInfo = Printer::GetQueueInfo( pBox->GetSelectEntry(), true ); 136*cdf0e10cSrcweir if( pInfo ) 137*cdf0e10cSrcweir rInfo = *pInfo; 138*cdf0e10cSrcweir } 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir // ----------------------------------------------------------------------- 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir static void ImplPrnDlgAddString( XubString& rStr, const XubString& rAddStr ) 144*cdf0e10cSrcweir { 145*cdf0e10cSrcweir if ( rStr.Len() ) 146*cdf0e10cSrcweir rStr.AppendAscii( "; " ); 147*cdf0e10cSrcweir rStr += rAddStr; 148*cdf0e10cSrcweir } 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir // ----------------------------------------------------------------------- 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir static void ImplPrnDlgAddResString( XubString& rStr, sal_uInt16 nResId ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir SvtResId aResId( nResId ); 155*cdf0e10cSrcweir XubString aAddStr( aResId ); 156*cdf0e10cSrcweir ImplPrnDlgAddString( rStr, aAddStr ); 157*cdf0e10cSrcweir } 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir // ----------------------------------------------------------------------- 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir XubString ImplPrnDlgGetStatusText( const QueueInfo& rInfo ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir XubString aStr; 164*cdf0e10cSrcweir sal_uLong nStatus = rInfo.GetStatus(); 165*cdf0e10cSrcweir 166*cdf0e10cSrcweir // Default-Printer 167*cdf0e10cSrcweir if ( rInfo.GetPrinterName().Len() && 168*cdf0e10cSrcweir (rInfo.GetPrinterName() == Printer::GetDefaultPrinterName()) ) 169*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_DEFPRINTER ); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir // Status 172*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_READY ) 173*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_READY ); 174*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PAUSED ) 175*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAUSED ); 176*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PENDING_DELETION ) 177*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PENDING ); 178*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_BUSY ) 179*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_BUSY ); 180*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_INITIALIZING ) 181*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_INITIALIZING ); 182*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_WAITING ) 183*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_WAITING ); 184*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_WARMING_UP ) 185*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_WARMING_UP ); 186*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PROCESSING ) 187*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PROCESSING ); 188*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PRINTING ) 189*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PRINTING ); 190*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_OFFLINE ) 191*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OFFLINE ); 192*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_ERROR ) 193*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_ERROR ); 194*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_SERVER_UNKNOWN ) 195*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_SERVER_UNKNOWN ); 196*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PAPER_JAM ) 197*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_JAM ); 198*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PAPER_OUT ) 199*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_OUT ); 200*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_MANUAL_FEED ) 201*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_MANUAL_FEED ); 202*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PAPER_PROBLEM ) 203*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAPER_PROBLEM ); 204*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_IO_ACTIVE ) 205*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_IO_ACTIVE ); 206*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_OUTPUT_BIN_FULL ) 207*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OUTPUT_BIN_FULL ); 208*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_TONER_LOW ) 209*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_TONER_LOW ); 210*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_NO_TONER ) 211*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_NO_TONER ); 212*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_PAGE_PUNT ) 213*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_PAGE_PUNT ); 214*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_USER_INTERVENTION ) 215*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_USER_INTERVENTION ); 216*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_OUT_OF_MEMORY ) 217*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_OUT_OF_MEMORY ); 218*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_DOOR_OPEN ) 219*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_DOOR_OPEN ); 220*cdf0e10cSrcweir if ( nStatus & QUEUE_STATUS_POWER_SAVE ) 221*cdf0e10cSrcweir ImplPrnDlgAddResString( aStr, STR_SVT_PRNDLG_POWER_SAVE ); 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir // Anzahl Jobs 224*cdf0e10cSrcweir sal_uLong nJobs = rInfo.GetJobs(); 225*cdf0e10cSrcweir if ( nJobs && (nJobs != QUEUE_JOBS_DONTKNOW) ) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir XubString aJobStr( SvtResId( STR_SVT_PRNDLG_JOBCOUNT ) ); 228*cdf0e10cSrcweir XubString aJobs( XubString::CreateFromInt32( nJobs ) ); 229*cdf0e10cSrcweir aJobStr.SearchAndReplaceAscii( "%d", aJobs ); 230*cdf0e10cSrcweir ImplPrnDlgAddString( aStr, aJobStr ); 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir return aStr; 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir // ======================================================================= 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir PrinterSetupDialog::PrinterSetupDialog( Window* pWindow ) : 239*cdf0e10cSrcweir ModalDialog ( pWindow, SvtResId( DLG_SVT_PRNDLG_PRNSETUPDLG ) ), 240*cdf0e10cSrcweir maFlPrinter ( this, SvtResId( FL_PRINTER ) ), 241*cdf0e10cSrcweir maFtName ( this, SvtResId( FT_NAME ) ), 242*cdf0e10cSrcweir maLbName ( this, SvtResId( LB_NAMES ) ), 243*cdf0e10cSrcweir maBtnProperties ( this, SvtResId( BTN_PROPERTIES ) ), 244*cdf0e10cSrcweir maBtnOptions ( this, SvtResId( BTN_OPTIONS ) ), 245*cdf0e10cSrcweir maFtStatus ( this, SvtResId( FT_STATUS ) ), 246*cdf0e10cSrcweir maFiStatus ( this, SvtResId( FI_STATUS ) ), 247*cdf0e10cSrcweir maFtType ( this, SvtResId( FT_TYPE ) ), 248*cdf0e10cSrcweir maFiType ( this, SvtResId( FI_TYPE ) ), 249*cdf0e10cSrcweir maFtLocation ( this, SvtResId( FT_LOCATION ) ), 250*cdf0e10cSrcweir maFiLocation ( this, SvtResId( FI_LOCATION ) ), 251*cdf0e10cSrcweir maFtComment ( this, SvtResId( FT_COMMENT ) ), 252*cdf0e10cSrcweir maFiComment ( this, SvtResId( FI_COMMENT ) ), 253*cdf0e10cSrcweir maFlSepButton ( this, SvtResId( FL_SEPBUTTON ) ), 254*cdf0e10cSrcweir maBtnOK ( this, SvtResId( BTN_OK ) ), 255*cdf0e10cSrcweir maBtnCancel ( this, SvtResId( BTN_CANCEL ) ), 256*cdf0e10cSrcweir maBtnHelp ( this, SvtResId( BTN_HELP ) ) 257*cdf0e10cSrcweir { 258*cdf0e10cSrcweir FreeResource(); 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir // show options button only if link is set 261*cdf0e10cSrcweir maBtnOptions.Hide(); 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir mpPrinter = NULL; 264*cdf0e10cSrcweir mpTempPrinter = NULL; 265*cdf0e10cSrcweir 266*cdf0e10cSrcweir maStatusTimer.SetTimeout( IMPL_PRINTDLG_STATUS_UPDATE ); 267*cdf0e10cSrcweir maStatusTimer.SetTimeoutHdl( LINK( this, PrinterSetupDialog, ImplStatusHdl ) ); 268*cdf0e10cSrcweir maBtnProperties.SetClickHdl( LINK( this, PrinterSetupDialog, ImplPropertiesHdl ) ); 269*cdf0e10cSrcweir maLbName.SetSelectHdl( LINK( this, PrinterSetupDialog, ImplChangePrinterHdl ) ); 270*cdf0e10cSrcweir } 271*cdf0e10cSrcweir 272*cdf0e10cSrcweir // ----------------------------------------------------------------------- 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir PrinterSetupDialog::~PrinterSetupDialog() 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir ImplFreePrnDlgListBox( &maLbName, sal_False ); 277*cdf0e10cSrcweir delete mpTempPrinter; 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir // ----------------------------------------------------------------------- 281*cdf0e10cSrcweir 282*cdf0e10cSrcweir void PrinterSetupDialog::SetOptionsHdl( const Link& rLink ) 283*cdf0e10cSrcweir { 284*cdf0e10cSrcweir maBtnOptions.SetClickHdl( rLink ); 285*cdf0e10cSrcweir maBtnOptions.Show( rLink.IsSet() ); 286*cdf0e10cSrcweir } 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir const Link& PrinterSetupDialog::GetOptionsHdl() const 289*cdf0e10cSrcweir { 290*cdf0e10cSrcweir return maBtnOptions.GetClickHdl(); 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir void PrinterSetupDialog::ImplSetInfo() 294*cdf0e10cSrcweir { 295*cdf0e10cSrcweir const QueueInfo* pInfo = Printer::GetQueueInfo(maLbName.GetSelectEntry(), true); 296*cdf0e10cSrcweir if ( pInfo ) 297*cdf0e10cSrcweir { 298*cdf0e10cSrcweir maFiType.SetText( pInfo->GetDriver() ); 299*cdf0e10cSrcweir maFiLocation.SetText( pInfo->GetLocation() ); 300*cdf0e10cSrcweir maFiComment.SetText( pInfo->GetComment() ); 301*cdf0e10cSrcweir maFiStatus.SetText( ImplPrnDlgGetStatusText( *pInfo ) ); 302*cdf0e10cSrcweir } 303*cdf0e10cSrcweir else 304*cdf0e10cSrcweir { 305*cdf0e10cSrcweir XubString aTempStr; 306*cdf0e10cSrcweir maFiType.SetText( aTempStr ); 307*cdf0e10cSrcweir maFiLocation.SetText( aTempStr ); 308*cdf0e10cSrcweir maFiComment.SetText( aTempStr ); 309*cdf0e10cSrcweir maFiStatus.SetText( aTempStr ); 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir } 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir // ----------------------------------------------------------------------- 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir IMPL_LINK( PrinterSetupDialog, ImplStatusHdl, Timer*, EMPTYARG ) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir QueueInfo aInfo; 318*cdf0e10cSrcweir ImplPrnDlgUpdateQueueInfo( &maLbName, aInfo ); 319*cdf0e10cSrcweir maFiStatus.SetText( ImplPrnDlgGetStatusText( aInfo ) ); 320*cdf0e10cSrcweir 321*cdf0e10cSrcweir return 0; 322*cdf0e10cSrcweir } 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir // ----------------------------------------------------------------------- 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir IMPL_LINK( PrinterSetupDialog, ImplPropertiesHdl, void*, EMPTYARG ) 327*cdf0e10cSrcweir { 328*cdf0e10cSrcweir if ( !mpTempPrinter ) 329*cdf0e10cSrcweir mpTempPrinter = new Printer( mpPrinter->GetJobSetup() ); 330*cdf0e10cSrcweir mpTempPrinter->Setup( this ); 331*cdf0e10cSrcweir 332*cdf0e10cSrcweir return 0; 333*cdf0e10cSrcweir } 334*cdf0e10cSrcweir 335*cdf0e10cSrcweir // ----------------------------------------------------------------------- 336*cdf0e10cSrcweir 337*cdf0e10cSrcweir IMPL_LINK( PrinterSetupDialog, ImplChangePrinterHdl, void*, EMPTYARG ) 338*cdf0e10cSrcweir { 339*cdf0e10cSrcweir mpTempPrinter = ImplPrnDlgListBoxSelect( &maLbName, &maBtnProperties, 340*cdf0e10cSrcweir mpPrinter, mpTempPrinter ); 341*cdf0e10cSrcweir ImplSetInfo(); 342*cdf0e10cSrcweir return 0; 343*cdf0e10cSrcweir } 344*cdf0e10cSrcweir 345*cdf0e10cSrcweir // ----------------------------------------------------------------------- 346*cdf0e10cSrcweir 347*cdf0e10cSrcweir long PrinterSetupDialog::Notify( NotifyEvent& rNEvt ) 348*cdf0e10cSrcweir { 349*cdf0e10cSrcweir if ( (rNEvt.GetType() == EVENT_GETFOCUS) && IsReallyVisible() ) 350*cdf0e10cSrcweir ImplStatusHdl( &maStatusTimer ); 351*cdf0e10cSrcweir 352*cdf0e10cSrcweir return ModalDialog::Notify( rNEvt ); 353*cdf0e10cSrcweir } 354*cdf0e10cSrcweir 355*cdf0e10cSrcweir // ----------------------------------------------------------------------- 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir void PrinterSetupDialog::DataChanged( const DataChangedEvent& rDCEvt ) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir if ( rDCEvt.GetType() == DATACHANGED_PRINTER ) 360*cdf0e10cSrcweir { 361*cdf0e10cSrcweir mpTempPrinter = ImplPrnDlgUpdatePrinter( mpPrinter, mpTempPrinter ); 362*cdf0e10cSrcweir Printer* pPrn; 363*cdf0e10cSrcweir if ( mpTempPrinter ) 364*cdf0e10cSrcweir pPrn = mpTempPrinter; 365*cdf0e10cSrcweir else 366*cdf0e10cSrcweir pPrn = mpPrinter; 367*cdf0e10cSrcweir ImplFillPrnDlgListBox( pPrn, &maLbName, &maBtnProperties ); 368*cdf0e10cSrcweir ImplSetInfo(); 369*cdf0e10cSrcweir } 370*cdf0e10cSrcweir 371*cdf0e10cSrcweir ModalDialog::DataChanged( rDCEvt ); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir // ----------------------------------------------------------------------- 375*cdf0e10cSrcweir 376*cdf0e10cSrcweir short PrinterSetupDialog::Execute() 377*cdf0e10cSrcweir { 378*cdf0e10cSrcweir if ( !mpPrinter || mpPrinter->IsPrinting() || mpPrinter->IsJobActive() ) 379*cdf0e10cSrcweir { 380*cdf0e10cSrcweir DBG_ERRORFILE( "PrinterSetupDialog::Execute() - No Printer or printer is printing" ); 381*cdf0e10cSrcweir return sal_False; 382*cdf0e10cSrcweir } 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir Printer::updatePrinters(); 385*cdf0e10cSrcweir 386*cdf0e10cSrcweir ImplFillPrnDlgListBox( mpPrinter, &maLbName, &maBtnProperties ); 387*cdf0e10cSrcweir ImplSetInfo(); 388*cdf0e10cSrcweir maStatusTimer.Start(); 389*cdf0e10cSrcweir 390*cdf0e10cSrcweir // Dialog starten 391*cdf0e10cSrcweir short nRet = ModalDialog::Execute(); 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir // Wenn Dialog mit OK beendet wurde, dann die Daten updaten 394*cdf0e10cSrcweir if ( nRet == sal_True ) 395*cdf0e10cSrcweir { 396*cdf0e10cSrcweir if ( mpTempPrinter ) 397*cdf0e10cSrcweir mpPrinter->SetPrinterProps( mpTempPrinter ); 398*cdf0e10cSrcweir } 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir maStatusTimer.Stop(); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir return nRet; 403*cdf0e10cSrcweir } 404