2 * Copyright (c) 1997-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 Change History (most recent first):
25 $Log: PrinterSetupWizardSheet.h,v $
26 Revision 1.11 2005/10/05 17:32:51 herscher
27 <rdar://problem/4141221> Use a case insensitive compare operation to check whether a printer with the same name has already been installed.
29 Revision 1.10 2005/07/07 17:53:19 shersche
30 Fix problems associated with the CUPS printer workaround fix.
32 Revision 1.9 2005/04/13 17:46:22 shersche
33 <rdar://problem/4082122> Generic PCL not selected when printers advertise multiple text records
35 Revision 1.8 2005/02/08 18:53:33 shersche
36 Remove qtotalDefined parameter from ParseTextRecord()
38 Revision 1.7 2005/01/31 23:54:29 shersche
39 <rdar://problem/3947508> Start browsing when printer wizard starts. Move browsing logic from CSecondPage object to CPrinterSetupWizardSheet object.
41 Revision 1.6 2005/01/03 19:05:01 shersche
42 Store pointer to instance of wizard sheet so that print driver install thread sends a window message to the correct window
44 Revision 1.5 2004/12/29 18:53:38 shersche
45 <rdar://problem/3725106>
46 <rdar://problem/3737413> Added support for LPR and IPP protocols as well as support for obtaining multiple text records. Reorganized and simplified codebase.
47 Bug #: 3725106, 3737413
49 Revision 1.4 2004/07/13 21:24:23 rpantos
50 Fix for <rdar://problem/3701120>.
52 Revision 1.3 2004/06/28 00:51:47 shersche
53 Move call to EnumPrinters out of browse callback into standalone function
55 Revision 1.2 2004/06/24 20:12:07 shersche
57 Submitted by: herscher
59 Revision 1.1 2004/06/18 04:36:57 rpantos
68 #include "firstpage.h"
69 #include "secondpage.h"
70 #include "thirdpage.h"
71 #include "fourthpage.h"
72 #include "UtilTypes.h"
77 using namespace PrinterSetupWizard
;
79 // CPrinterSetupWizardSheet
81 class CPrinterSetupWizardSheet
: public CPropertySheet
83 DECLARE_DYNAMIC(CPrinterSetupWizardSheet
)
87 struct WizardException
95 CPrinterSetupWizardSheet(UINT nIDCaption
, CWnd
* pParentWnd
= NULL
, UINT iSelectPage
= 0);
96 virtual ~CPrinterSetupWizardSheet();
102 SetLastPage(CPropertyPage
* page
);
105 SetSelectedPrinter(Printer
* printer
);
108 GetSelectedPrinter();
111 LoadPrinterDriver(const CString
& filename
);
117 // handles end of process event
120 OnProcessEvent(WPARAM inWParam
, LPARAM inLParam
);
123 OnSocketEvent(WPARAM inWParam
, LPARAM inLParam
);
126 OnCommand(WPARAM wParam
, LPARAM lParam
);
132 OnSetCursor(CWnd
* pWnd
, UINT nHitTest
, UINT message
);
135 OnContextMenu(CWnd
* pWnd
, CPoint pos
);
141 StartResolve( Printer
* printer
);
144 StopResolve( Printer
* printer
);
153 DECLARE_MESSAGE_MAP()
154 CFirstPage m_pgFirst
;
155 CSecondPage m_pgSecond
;
156 CThirdPage m_pgThird
;
157 CFourthPage m_pgFourth
;
167 static void DNSSD_API
170 DNSServiceFlags inFlags
,
171 uint32_t inInterfaceIndex
,
172 DNSServiceErrorType inErrorCode
,
175 const char * inDomain
,
178 static void DNSSD_API
181 DNSServiceFlags inFlags
,
182 uint32_t inInterfaceIndex
,
183 DNSServiceErrorType inErrorCode
,
184 const char * inFullName
,
185 const char * inHostName
,
191 static void DNSSD_API
194 DNSServiceFlags inFlags
,
195 uint32_t inInterfaceIndex
,
196 DNSServiceErrorType inErrorCode
,
197 const char * inFullName
,
201 const void * inRData
,
207 uint32_t inInterfaceIndex
,
210 const char * inDomain
,
221 uint32_t inInterfaceIndex
,
224 const char * inDomain
);
235 OrderServiceFunc( const Service
* a
, const Service
* b
);
238 OrderQueueFunc( const Queue
* q1
, const Queue
* q2
);
241 StartOperation( DNSServiceRef ref
);
244 StopOperation( DNSServiceRef
& ref
);
253 StartResolve( Service
* service
);
256 StopResolve( Service
* service
);
259 ParseTextRecord( Service
* service
, Queue
* q
, uint16_t inTXTSize
, const char * inTXT
);
265 Lookup( const char * name
);
268 InstallPrinter(Printer
* printer
);
271 InstallPrinterPDLAndLPR(Printer
* printer
, Service
* service
, DWORD protocol
);
274 InstallPrinterIPP(Printer
* printer
, Service
* service
);
276 static unsigned WINAPI
277 InstallDriverThread( LPVOID inParam
);
279 typedef std::list
<CString
> PrinterNames
;
280 typedef std::list
<DNSServiceRef
> ServiceRefList
;
281 static CPrinterSetupWizardSheet
* m_self
;
282 PrinterNames m_printerNames
;
283 Printer
* m_selectedPrinter
;
284 bool m_driverThreadFinished
;
285 DWORD m_driverThreadExitCode
;
286 ServiceRefList m_serviceRefList
;
287 DNSServiceRef m_pdlBrowser
;
288 DNSServiceRef m_lprBrowser
;
289 DNSServiceRef m_ippBrowser
;
290 DNSServiceRef m_resolver
;
292 CPropertyPage
* m_lastPage
;
297 CPrinterSetupWizardSheet::GetSelectedPrinter()
299 return m_selectedPrinter
;
304 CPrinterSetupWizardSheet::GetCursor()
310 inline CPropertyPage
*
311 CPrinterSetupWizardSheet::GetLastPage()
318 CPrinterSetupWizardSheet::SetLastPage(CPropertyPage
* lastPage
)
320 m_lastPage
= lastPage
;
326 #define kPDLServiceType "_pdl-datastream._tcp."
327 #define kLPRServiceType "_printer._tcp."
328 #define kIPPServiceType "_ipp._tcp."