Avoid potential negative array index access to cached text.
[LibreOffice.git] / vcl / inc / jobset.h
blob7c0d0b55a4c377f752297d3b6e6c4ff67845a953
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 #ifndef INCLUDED_VCL_INC_JOBSET_H
21 #define INCLUDED_VCL_INC_JOBSET_H
23 #include <rtl/ustring.hxx>
24 #include <i18nutil/paper.hxx>
25 #include <vcl/dllapi.h>
26 #include <vcl/prntypes.hxx>
27 #include <unordered_map>
28 #include <memory>
30 // see com.sun.star.portal.client.JobSetupSystem.idl:
31 #define JOBSETUP_SYSTEM_WINDOWS 1
32 #define JOBSETUP_SYSTEM_UNIX 3
33 #define JOBSETUP_SYSTEM_MAC 4
35 class VCL_DLLPUBLIC ImplJobSetup
37 private:
38 sal_uInt16 mnSystem; //< System - JOBSETUP_SYSTEM_xxxx
39 OUString maPrinterName; //< Printer-Name
40 OUString maDriver; //< Driver-Name
41 Orientation meOrientation; //< Orientation
42 DuplexMode meDuplexMode; //< Duplex
43 sal_uInt16 mnPaperBin; //< paper bin / in tray
44 Paper mePaperFormat; //< paper format
45 tools::Long mnPaperWidth; //< paper width (100th mm)
46 tools::Long mnPaperHeight; //< paper height (100th mm)
47 sal_uInt32 mnDriverDataLen; //< length of system specific data
48 std::unique_ptr<sal_uInt8[]> mpDriverData; //< system specific data (will be streamed a byte block)
49 bool mbPapersizeFromSetup;
50 // setup mode
51 PrinterSetupMode meSetupMode;
52 // TODO: orig paper size
53 std::unordered_map< OUString, OUString > maValueMap;
55 public:
56 ImplJobSetup();
57 ImplJobSetup( const ImplJobSetup& rJobSetup );
58 ~ImplJobSetup();
60 bool operator==( const ImplJobSetup& rImplJobSetup ) const;
62 sal_uInt16 GetSystem() const { return mnSystem; }
63 void SetSystem(sal_uInt16 nSystem);
65 const OUString& GetPrinterName() const { return maPrinterName; }
66 void SetPrinterName(const OUString& rPrinterName);
68 const OUString& GetDriver() const { return maDriver; }
69 void SetDriver(const OUString& rDriver);
71 Orientation GetOrientation() const { return meOrientation; }
72 void SetOrientation(Orientation eOrientation);
74 DuplexMode GetDuplexMode() const { return meDuplexMode; }
75 void SetDuplexMode(DuplexMode eDuplexMode);
77 sal_uInt16 GetPaperBin() const { return mnPaperBin; }
78 void SetPaperBin(sal_uInt16 nPaperBin);
80 Paper GetPaperFormat() const { return mePaperFormat; }
81 void SetPaperFormat(Paper ePaperFormat);
83 tools::Long GetPaperWidth() const { return mnPaperWidth; }
84 void SetPaperWidth(tools::Long nWidth);
86 tools::Long GetPaperHeight() const { return mnPaperHeight; }
87 void SetPaperHeight(tools::Long nHeight);
89 sal_uInt32 GetDriverDataLen() const { return mnDriverDataLen; }
90 const sal_uInt8* GetDriverData() const { return mpDriverData.get(); }
91 void SetDriverData(std::unique_ptr<sal_uInt8[]> pDriverData, sal_uInt32 nDriverDataLen);
93 bool GetPapersizeFromSetup() const { return mbPapersizeFromSetup; }
94 void SetPapersizeFromSetup(bool bPapersizeFromSetup);
96 PrinterSetupMode GetPrinterSetupMode() const { return meSetupMode; }
97 void SetPrinterSetupMode(PrinterSetupMode eMode);
99 const std::unordered_map< OUString, OUString >& GetValueMap() const
100 { return maValueMap; }
101 void SetValueMap(const OUString& rKey, const OUString& rValue);
104 // If paper format is PAPER_USER, in the system-independent part it will
105 // automatically be computed from paper width/height.
106 // If paper width/height is 0, in the system-independent part it will
107 // automatically be computed from paper format, if the latter is not PAPER_USER.
109 #endif // INCLUDED_VCL_INC_JOBSET_H
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */