Avoid potential negative array index access to cached text.
[LibreOffice.git] / include / vcl / printer / Options.hxx
blobcd425bd101fb8377e11fe682968ec44182680c32
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 <sal/config.h>
24 #include <config_options.h>
26 #include <sal/types.h>
28 #include <vcl/dllapi.h>
30 namespace vcl::printer
32 enum class TransparencyMode
34 Auto = 0,
35 NONE = 1
38 enum class GradientMode
40 Stripes = 0,
41 Color = 1
44 enum class BitmapMode
46 Optimal = 0,
47 Normal = 1,
48 Resolution = 2
51 class UNLESS_MERGELIBS(VCL_DLLPUBLIC) Options
53 private:
54 bool mbReduceTransparency = false;
55 TransparencyMode meReducedTransparencyMode = TransparencyMode::Auto;
56 bool mbReduceGradients = false;
57 GradientMode meReducedGradientsMode = GradientMode::Stripes;
58 sal_uInt16 mnReducedGradientStepCount = 64;
59 bool mbReduceBitmaps = false;
60 BitmapMode meReducedBitmapMode = BitmapMode::Normal;
61 sal_uInt16 mnReducedBitmapResolution = 200;
62 bool mbReducedBitmapsIncludeTransparency = true;
63 bool mbConvertToGreyscales = false;
65 public:
66 Options() = default;
68 bool IsReduceTransparency() const { return mbReduceTransparency; }
69 void SetReduceTransparency(bool bSet) { mbReduceTransparency = bSet; }
71 TransparencyMode GetReducedTransparencyMode() const { return meReducedTransparencyMode; }
72 void SetReducedTransparencyMode(TransparencyMode eMode) { meReducedTransparencyMode = eMode; }
74 bool IsReduceGradients() const { return mbReduceGradients; }
75 void SetReduceGradients(bool bSet) { mbReduceGradients = bSet; }
77 GradientMode GetReducedGradientMode() const { return meReducedGradientsMode; }
78 void SetReducedGradientMode(GradientMode eMode) { meReducedGradientsMode = eMode; }
80 sal_uInt16 GetReducedGradientStepCount() const { return mnReducedGradientStepCount; }
81 void SetReducedGradientStepCount(sal_uInt16 nStepCount)
83 mnReducedGradientStepCount = nStepCount;
86 bool IsReduceBitmaps() const { return mbReduceBitmaps; }
87 void SetReduceBitmaps(bool bSet) { mbReduceBitmaps = bSet; }
89 BitmapMode GetReducedBitmapMode() const { return meReducedBitmapMode; }
90 void SetReducedBitmapMode(BitmapMode eMode) { meReducedBitmapMode = eMode; }
92 sal_uInt16 GetReducedBitmapResolution() const { return mnReducedBitmapResolution; }
93 void SetReducedBitmapResolution(sal_uInt16 nResolution)
95 mnReducedBitmapResolution = nResolution;
98 bool IsReducedBitmapIncludesTransparency() const { return mbReducedBitmapsIncludeTransparency; }
99 void SetReducedBitmapIncludesTransparency(bool bSet)
101 mbReducedBitmapsIncludeTransparency = bSet;
104 bool IsConvertToGreyscales() const { return mbConvertToGreyscales; }
105 void SetConvertToGreyscales(bool bSet) { mbConvertToGreyscales = bSet; }
107 /** Read printer options from configuration
109 parameter decides whether the set for
110 print "to printer" or "to file" should be read.
112 void ReadFromConfig(bool bFile);
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */