LibreOffice Module svtools (master) 1
optionsdrawinglayer.cxx
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
21#include <vcl/svapp.hxx>
22#include <vcl/outdev.hxx>
23#include <vcl/settings.hxx>
24#include <officecfg/Office/Common.hxx>
27#include <mutex>
28
29// #i73602#
30// #i74769#, #i75172#
31// #i4219#
32
34{
35
37{
38 return officecfg::Office::Common::Drawinglayer::OverlayBuffer::get();
39}
40
42{
43 return officecfg::Office::Common::Drawinglayer::PaintBuffer::get();
44}
45
47{
48 return Color(ColorTransparency, officecfg::Office::Common::Drawinglayer::StripeColorA::get());
49}
50
52{
53 return Color(ColorTransparency, officecfg::Office::Common::Drawinglayer::StripeColorB::get());
54}
55
56sal_uInt16 GetStripeLength()
57{
58 return officecfg::Office::Common::Drawinglayer::StripeLength::get();
59}
60
62{
63 return !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Drawinglayer::OverlayBuffer_Calc::get();
64}
65
67{
68 return !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Drawinglayer::OverlayBuffer_Writer::get();
69}
70
72{
73 return !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Drawinglayer::OverlayBuffer_DrawImpress::get();
74}
75
76// #i74769#, #i75172#
78{
79 return !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Drawinglayer::PaintBuffer_Calc::get();
80}
81
83{
84 return !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Drawinglayer::PaintBuffer_Writer::get();
85}
86
88{
89 return !utl::ConfigManager::IsFuzzing() && officecfg::Office::Common::Drawinglayer::PaintBuffer_DrawImpress::get();
90}
91
92// #i4219#
94{
95 return officecfg::Office::Common::Drawinglayer::MaximumPaperWidth::get();
96}
97
99{
100 return officecfg::Office::Common::Drawinglayer::MaximumPaperHeight::get();
101}
102
104{
105 return officecfg::Office::Common::Drawinglayer::MaximumPaperLeftMargin::get();
106}
107
109{
110 return officecfg::Office::Common::Drawinglayer::MaximumPaperRightMargin::get();
111}
112
114{
115 return officecfg::Office::Common::Drawinglayer::MaximumPaperTopMargin::get();
116}
117
119{
120 return officecfg::Office::Common::Drawinglayer::MaximumPaperBottomMargin::get();
121}
122
125
127{
128 static const bool gbAllowAA
129 = Application::GetDefaultDevice()->SupportsOperation(OutDevSupportType::TransparentRect);
130 return gbAllowAA;
131}
132
133
135{
137 if (bAntiAliasing && !IsAAPossibleOnThisSystem())
138 {
140 bAntiAliasing = false;
141 }
142 return bAntiAliasing;
143}
144
150void SetAntiAliasing( bool bOn, bool bTemporary )
151{
153}
154
155
157{
158 const bool bRetval(IsAntiAliasing() && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get());
159
161 {
165 }
166
167 return bRetval;
168}
169
171{
172 return officecfg::Office::Common::Drawinglayer::SolidDragCreate::get();
173}
174
176{
177 return officecfg::Office::Common::Drawinglayer::RenderDecoratedTextDirect::get();
178}
179
181{
182 return officecfg::Office::Common::Drawinglayer::RenderSimpleTextDirect::get();
183}
184
186{
187 return officecfg::Office::Common::Drawinglayer::Quadratic3DRenderLimit::get();
188}
189
191{
192 return officecfg::Office::Common::Drawinglayer::QuadraticFormControlRenderLimit::get();
193}
194
195// #i97672# selection settings
197{
198 return officecfg::Office::Common::Drawinglayer::TransparentSelection::get();
199}
200
202{
203 sal_uInt16 aRetval = officecfg::Office::Common::Drawinglayer::TransparentSelectionPercent::get();
204
205 // crop to range [10% .. 90%]
206 if(aRetval < 10)
207 {
208 aRetval = 10;
209 }
210
211 if(aRetval > 90)
212 {
213 aRetval = 90;
214 }
215
216 return aRetval;
217}
218
220{
221 sal_uInt16 aRetval = officecfg::Office::Common::Drawinglayer::SelectionMaximumLuminancePercent::get();
222
223 // crop to range [0% .. 100%]
224 if(aRetval > 90)
225 {
226 aRetval = 90;
227 }
228
229 return aRetval;
230}
231
233{
234 Color aRetval(Application::GetSettings().GetStyleSettings().GetHighlightColor());
235 const basegfx::BColor aSelection(aRetval.getBColor());
236 const double fLuminance(aSelection.luminance());
237 const double fMaxLum(GetSelectionMaximumLuminancePercent() / 100.0);
238
239 if(fLuminance > fMaxLum)
240 {
241 const double fFactor(fMaxLum / fLuminance);
243 aSelection.getRed() * fFactor,
244 aSelection.getGreen() * fFactor,
245 aSelection.getBlue() * fFactor);
246
247 aRetval = Color(aNewSelection);
248 }
249
250 return aRetval;
251}
252
253} // namespace SvtOptionsDrawinglayer
254
255/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static OutputDevice * GetDefaultDevice()
static const AllSettings & GetSettings()
basegfx::BColor getBColor() const
bool SupportsOperation(OutDevSupportType) const
double getBlue() const
double luminance() const
double getRed() const
double getGreen() const
static void forwardPixelSnapHairline(bool bPixelSnapHairline)
static void setGlobalAntiAliasing(bool bAntiAliasing, bool bTemporary)
static bool IsFuzzing()
ColorTransparency
ESelection aNewSelection(GetSelection())
static bool gbPixelSnapHairlineForwardLast(true)
sal_uInt16 GetTransparentSelectionPercent()
sal_uInt32 GetMaximumPaperBottomMargin()
void SetAntiAliasing(bool bOn, bool bTemporary)
Some code like to turn this stuff on and off during a drawing operation so it can "tunnel" informatio...
static bool gbPixelSnapHairlineForwardInitial(false)
sal_uInt32 GetQuadraticFormControlRenderLimit()
sal_uInt16 GetSelectionMaximumLuminancePercent()