cid#1607171 Data race condition
[LibreOffice.git] / vcl / inc / win / salprn.h
blobd44687d8e060e85ecce482b6f0fc787eb3831e24
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <salprn.hxx>
25 // WNT3
26 #define SAL_DRIVERDATA_SYSSIGN ((sal_uIntPtr)0x574E5433)
28 #pragma pack( 1 )
30 struct SalDriverData
32 sal_uIntPtr mnSysSignature;
33 sal_uInt16 mnDriverOffset;
34 BYTE maDriverData[1];
37 #pragma pack()
40 class WinSalGraphics;
42 class WinSalInfoPrinter final : public SalInfoPrinter
44 public:
45 OUString maDriverName; // printer driver name
46 OUString maDeviceName; // printer device name
47 OUString maPortName; // printer port name
49 private:
50 HDC m_hDC; ///< printer hdc
51 WinSalGraphics* m_pGraphics; ///< current Printer graphics
52 bool m_bGraphics; ///< is Graphics used
54 public:
55 WinSalInfoPrinter();
56 virtual ~WinSalInfoPrinter() override;
58 void setHDC(HDC);
60 virtual SalGraphics* AcquireGraphics() override;
61 virtual void ReleaseGraphics( SalGraphics* pGraphics ) override;
62 virtual bool Setup( weld::Window* pFrame, ImplJobSetup* pSetupData ) override;
63 virtual bool SetPrinterData( ImplJobSetup* pSetupData ) override;
64 virtual bool SetData( JobSetFlags nFlags, ImplJobSetup* pSetupData ) override;
65 virtual void GetPageInfo( const ImplJobSetup* pSetupData,
66 tools::Long& rOutWidth, tools::Long& rOutHeight,
67 Point& rPageOffset,
68 Size& rPaperSize ) override;
69 virtual sal_uInt32 GetCapabilities( const ImplJobSetup* pSetupData, PrinterCapType nType ) override;
70 virtual sal_uInt16 GetPaperBinCount( const ImplJobSetup* pSetupData ) override;
71 virtual OUString GetPaperBinName( const ImplJobSetup* pSetupData, sal_uInt16 nPaperBin ) override;
72 virtual sal_uInt16 GetPaperBinBySourceIndex(const ImplJobSetup* pSetupData,
73 sal_uInt16 nPaperSource) override;
74 virtual sal_uInt16 GetSourceIndexByPaperBin(const ImplJobSetup* pSetupData,
75 sal_uInt16 nPaperBin) override;
77 virtual void InitPaperFormats( const ImplJobSetup* pSetupData ) override;
78 virtual int GetLandscapeAngle( const ImplJobSetup* pSetupData ) override;
82 class WinSalPrinter : public SalPrinter
84 public:
85 std::unique_ptr<WinSalGraphics> mxGraphics; // current Printer graphics
86 WinSalInfoPrinter* mpInfoPrinter; // pointer to the compatible InfoPrinter
87 WinSalPrinter* mpNextPrinter; // next printing printer
88 HDC mhDC; // printer hdc
89 SalPrinterError mnError; // error code
90 sal_uInt32 mnCopies; // copies
91 bool mbCollate; // collated copies
92 bool mbAbort; // Job Aborted
94 bool mbValid;
96 protected:
97 void DoEndDoc(HDC hDC);
99 public:
100 WinSalPrinter();
101 virtual ~WinSalPrinter() override;
103 using SalPrinter::StartJob;
104 virtual bool StartJob( const OUString* pFileName,
105 const OUString& rJobName,
106 const OUString& rAppName,
107 sal_uInt32 nCopies,
108 bool bCollate,
109 bool bDirect,
110 ImplJobSetup* pSetupData ) override;
111 virtual bool EndJob() override;
112 virtual SalGraphics* StartPage( ImplJobSetup* pSetupData, bool bNewJobData ) override;
113 virtual void EndPage() override;
114 virtual SalPrinterError GetErrorCode() override;
116 void markInvalid();
117 bool isValid() const { return mbValid && mhDC; }
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */