Line data Source code
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 : */
10 :
11 : #include <vcl/rendersettings.hxx>
12 :
13 : namespace vcl
14 : {
15 :
16 : void RenderSettings::SetLineColor(const Color& rColor)
17 : {
18 : maOutDevState.mpLineColor = new Color(rColor);
19 : maOutDevState.mnFlags |= PushFlags::LINECOLOR;
20 : }
21 :
22 : void RenderSettings::SetFillColor(const Color& rColor)
23 : {
24 : maOutDevState.mpFillColor = new Color(rColor);
25 : maOutDevState.mnFlags |= PushFlags::FILLCOLOR;
26 : }
27 :
28 : void RenderSettings::SetFont(const vcl::Font& rNewFont)
29 : {
30 : maOutDevState.mpFont = new vcl::Font(rNewFont);
31 : maOutDevState.mnFlags |= PushFlags::FONT;
32 : }
33 :
34 : void RenderSettings::SetBackground(const Wallpaper& rBackground)
35 : {
36 : mpBackground.reset(new Wallpaper(rBackground));
37 : }
38 :
39 0 : void RenderSettings::PushAndApply(vcl::RenderContext& rRenderContext)
40 : {
41 0 : rRenderContext.Push(maOutDevState.mnFlags);
42 0 : Apply(rRenderContext);
43 0 : }
44 :
45 0 : void RenderSettings::Apply(vcl::RenderContext& rRenderContext)
46 : {
47 0 : if (maOutDevState.mnFlags & PushFlags::LINECOLOR)
48 0 : rRenderContext.SetLineColor(*maOutDevState.mpLineColor);
49 0 : if (maOutDevState.mnFlags & PushFlags::FILLCOLOR)
50 0 : rRenderContext.SetFillColor(*maOutDevState.mpFillColor);
51 0 : if (maOutDevState.mnFlags & PushFlags::FONT)
52 0 : rRenderContext.SetFont(*maOutDevState.mpFont);
53 0 : if (mpBackground)
54 0 : rRenderContext.SetBackground(Wallpaper(*mpBackground.get()));
55 0 : }
56 :
57 : }
58 :
59 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|