LibreOffice Module vcl (master)  1
win/salprn.h
Go to the documentation of this file.
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 
32 {
33  sal_uIntPtr mnSysSignature;
34  sal_uInt16 mnDriverOffset;
36 };
37 
38 #pragma pack()
39 
40 
41 class WinSalGraphics;
42 
43 class WinSalInfoPrinter final : public SalInfoPrinter
44 {
45 public:
46  OUString maDriverName; // printer driver name
47  OUString maDeviceName; // printer device name
48  OUString maPortName; // printer port name
49 
50 private:
51  HDC m_hDC;
53  bool m_bGraphics;
54 
55 public:
57  virtual ~WinSalInfoPrinter() override;
58 
59  void setHDC(HDC);
60 
61  virtual SalGraphics* AcquireGraphics() override;
62  virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
63  virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override;
64  virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override;
65  virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override;
66  virtual void GetPageInfo( const ImplJobSetup* pSetupData,
67  tools::Long& rOutWidth, tools::Long& rOutHeight,
68  Point& rPageOffset,
69  Size& rPaperSize ) override;
70  virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override;
71  virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* pSetupData ) override;
72  virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override;
73  virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override;
74  virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override;
75 };
76 
77 
78 class WinSalPrinter : public SalPrinter
79 {
80 public:
81  std::unique_ptr<WinSalGraphics> mxGraphics; // current Printer graphics
82  WinSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
83  WinSalPrinter* mpNextPrinter; // next printing printer
84  HDC mhDC; // printer hdc
85  SalPrinterError mnError; // error code
86  sal_uInt32 mnCopies; // copies
87  bool mbCollate; // collated copies
88  bool mbAbort; // Job Aborted
89 
90  bool mbValid;
91 
92 protected:
93  void DoEndDoc(HDC hDC);
94 
95 public:
96  WinSalPrinter();
97  virtual ~WinSalPrinter() override;
98 
100  virtual bool StartJob( const OUString* pFileName,
101  const OUString& rJobName,
102  const OUString& rAppName,
103  sal_uInt32 nCopies,
104  bool bCollate,
105  bool bDirect,
106  ImplJobSetup* pSetupData ) override;
107  virtual bool EndJob() override;
108  virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override;
109  virtual void EndPage() override;
110  virtual SalPrinterError GetErrorCode() override;
111 
112  void markInvalid();
113  bool isValid() const { return mbValid && mhDC; }
114 };
115 
116 #endif // INCLUDED_VCL_INC_WIN_SALPRN_H
117 
118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void InitPaperFormats(const ImplJobSetup *pSetupData) override
virtual sal_uInt16 GetPaperBinCount(const ImplJobSetup *pSetupData) override
sal_uIntPtr mnSysSignature
Definition: win/salprn.h:33
WinSalInfoPrinter * mpInfoPrinter
Definition: win/salprn.h:82
PrinterCapType
Definition: prntypes.hxx:71
unsigned char BYTE
long Long
virtual bool StartJob(const OUString *pFileName, const OUString &rJobName, const OUString &rAppName, sal_uInt32 nCopies, bool bCollate, bool bDirect, ImplJobSetup *pSetupData)=0
WinSalPrinter * mpNextPrinter
Definition: win/salprn.h:83
sal_uInt32 mnCopies
Definition: win/salprn.h:86
virtual bool SetPrinterData(ImplJobSetup *pSetupData) override
virtual sal_uInt32 GetCapabilities(const ImplJobSetup *pSetupData, PrinterCapType nType) override
bool m_bGraphics
is Graphics used
Definition: win/salprn.h:53
virtual bool StartJob(const OUString *pFileName, const OUString &rJobName, const OUString &rAppName, sal_uInt32 nCopies, bool bCollate, bool bDirect, ImplJobSetup *pSetupData) override
virtual SalGraphics * StartPage(ImplJobSetup *pSetupData, bool bNewJobData) override
SalPrinterError mnError
Definition: win/salprn.h:85
virtual void EndPage() override
virtual ~WinSalPrinter() override
OUString maDeviceName
Definition: win/salprn.h:47
virtual OUString GetPaperBinName(const ImplJobSetup *pSetupData, sal_uInt16 nPaperBin) override
HDC m_hDC
printer hdc
Definition: win/salprn.h:51
JobSetFlags
Definition: salptype.hxx:27
WinSalGraphics * m_pGraphics
current Printer graphics
Definition: win/salprn.h:52
virtual bool SetData(JobSetFlags nFlags, ImplJobSetup *pSetupData) override
void markInvalid()
virtual void GetPageInfo(const ImplJobSetup *pSetupData, tools::Long &rOutWidth, tools::Long &rOutHeight, Point &rPageOffset, Size &rPaperSize) override
sal_uInt16 mnDriverOffset
Definition: win/salprn.h:34
virtual bool Setup(weld::Window *pFrame, ImplJobSetup *pSetupData) override
virtual void ReleaseGraphics(SalGraphics *pGraphics) override
virtual SalGraphics * AcquireGraphics() override
bool mbCollate
Definition: win/salprn.h:87
OUString maPortName
Definition: win/salprn.h:48
virtual int GetLandscapeAngle(const ImplJobSetup *pSetupData) override
void DoEndDoc(HDC hDC)
std::unique_ptr< WinSalGraphics > mxGraphics
Definition: win/salprn.h:81
virtual SalPrinterError GetErrorCode() override
WinSalGraphics never owns the HDC it uses to draw, because the HDC can have various origins with diff...
Definition: win/salgdi.h:151
BYTE maDriverData[1]
Definition: win/salprn.h:35
bool isValid() const
Definition: win/salprn.h:113
OUString maDriverName
Definition: win/salprn.h:46
SalPrinterError
Definition: salptype.hxx:41
virtual bool EndJob() override
virtual ~WinSalInfoPrinter() override