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 INCLUDED_VCL_INC_WIN_SALPRN_H
21 #define INCLUDED_VCL_INC_WIN_SALPRN_H
22 
23 #include <salprn.hxx>
24 
25 
26 // WNT3
27 #define SAL_DRIVERDATA_SYSSIGN              ((sal_uIntPtr)0x574E5433)
28 
29 #pragma pack( 1 )
30 
31 struct SalDriverData
32 {
33     sal_uIntPtr                 mnSysSignature;
34     sal_uInt16                  mnDriverOffset;
35     BYTE                    maDriverData[1];
36 };
37 
38 #pragma pack()
39 
40 
41 class WinSalGraphics;
42 
43 class WinSalInfoPrinter : public SalInfoPrinter
44 {
45 public:
46     WinSalGraphics*        mpGraphics;             // current Printer graphics
47     OUString               maDriverName;           // printer driver name
48     OUString               maDeviceName;           // printer device name
49     OUString               maPortName;             // printer port name
50     HDC                    mhDC;                   // printer hdc
51     bool                   mbGraphics;             // is Graphics used
52 public:
53     WinSalInfoPrinter();
54     virtual ~WinSalInfoPrinter() override;
55 
56     virtual SalGraphics*            AcquireGraphics() override;
57     virtual void                    ReleaseGraphics( SalGraphics* pGraphics ) override;
58     virtual bool                    Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override;
59     virtual bool                    SetPrinterData( ImplJobSetup* pSetupData ) override;
60     virtual bool                    SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override;
61     virtual void                    GetPageInfo( const ImplJobSetup* pSetupData,
62                                                  long& rOutWidth, long& rOutHeight,
63                                                  Point& rPageOffset,
64                                                  Size& rPaperSize ) override;
65     virtual sal_uInt32              GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override;
66     virtual sal_uInt16              GetPaperBinCount( const ImplJobSetup* pSetupData ) override;
67     virtual OUString                GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override;
68     virtual void                    InitPaperFormats( const ImplJobSetup* pSetupData ) override;
69     virtual int                     GetLandscapeAngle( const ImplJobSetup* pSetupData ) override;
70 };
71 
72 
73 class WinSalPrinter : public SalPrinter
74 {
75 public:
76     WinSalGraphics*         mpGraphics;             // current Printer graphics
77     WinSalInfoPrinter*      mpInfoPrinter;          // pointer to the compatible InfoPrinter
78     WinSalPrinter*          mpNextPrinter;          // next printing printer
79     HDC                     mhDC;                   // printer hdc
80     SalPrinterError         mnError;                // error code
81     sal_uIntPtr             mnCopies;               // copies
82     bool                    mbCollate;              // collated copies
83     bool                    mbAbort;                // Job Aborted
84 
85     bool                    mbValid;
86 
87 protected:
88     void                            DoEndDoc(HDC hDC);
89 
90 public:
91     WinSalPrinter();
92     virtual ~WinSalPrinter() override;
93 
94     using SalPrinter::StartJob;
95     virtual bool                    StartJob( const OUString* pFileName,
96                                               const OUString& rJobName,
97                                               const OUString& rAppName,
98                                               sal_uInt32 nCopies,
99                                               bool bCollate,
100                                               bool bDirect,
101                                               ImplJobSetup* pSetupData ) override;
102     virtual bool                    EndJob() override;
103     virtual SalGraphics*            StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override;
104     virtual void                    EndPage() override;
105     virtual SalPrinterError         GetErrorCode() override;
106 
107     void markInvalid();
isValid()108     bool isValid() const { return mbValid; }
109 };
110 
111 #endif // INCLUDED_VCL_INC_WIN_SALPRN_H
112 
113 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
114