1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include <svtools/optionsdrawinglayer.hxx>
21 #include <vcl/svapp.hxx>
22 #include <vcl/outdev.hxx>
23 #include <vcl/settings.hxx>
24 #include <officecfg/Office/Common.hxx>
25 #include <unotools/configmgr.hxx>
26 #include <drawinglayer/geometry/viewinformation2d.hxx>
33 namespace SvtOptionsDrawinglayer
36 Color
GetStripeColorA()
38 return Color(ColorTransparency
, officecfg::Office::Common::Drawinglayer::StripeColorA::get());
41 Color
GetStripeColorB()
43 return Color(ColorTransparency
, officecfg::Office::Common::Drawinglayer::StripeColorB::get());
48 return drawinglayer::geometry::ViewInformation2D::getGlobalAntiAliasing();
52 * Some code like to turn this stuff on and off during a drawing operation
53 * so it can "tunnel" information down through several layers,
54 * so we don't want to actually do a config write all the time.
56 void SetAntiAliasing( bool bOn
, bool bTemporary
)
58 drawinglayer::geometry::ViewInformation2D::setGlobalAntiAliasing(bOn
, bTemporary
);
62 bool IsSnapHorVerLinesToDiscrete()
64 return IsAntiAliasing() && officecfg::Office::Common::Drawinglayer::SnapHorVerLinesToDiscrete::get();
67 sal_uInt16
GetTransparentSelectionPercent()
69 sal_uInt16 aRetval
= officecfg::Office::Common::Drawinglayer::TransparentSelectionPercent::get();
71 // crop to range [10% .. 90%]
85 sal_uInt16
GetSelectionMaximumLuminancePercent()
87 sal_uInt16 aRetval
= officecfg::Office::Common::Drawinglayer::SelectionMaximumLuminancePercent::get();
89 // crop to range [0% .. 100%]
98 Color
getHilightColor()
100 Color
aRetval(Application::GetSettings().GetStyleSettings().GetHighlightColor());
101 const basegfx::BColor
aSelection(aRetval
.getBColor());
102 const double fLuminance(aSelection
.luminance());
103 const double fMaxLum(GetSelectionMaximumLuminancePercent() / 100.0);
105 if(fLuminance
> fMaxLum
)
107 const double fFactor(fMaxLum
/ fLuminance
);
108 const basegfx::BColor
aNewSelection(
109 aSelection
.getRed() * fFactor
,
110 aSelection
.getGreen() * fFactor
,
111 aSelection
.getBlue() * fFactor
);
113 aRetval
= Color(aNewSelection
);
119 } // namespace SvtOptionsDrawinglayer
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */