LibreOffice Module svx (master) 1
xgrad.hxx
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
20#ifndef INCLUDED_SVX_XGRAD_HXX
21#define INCLUDED_SVX_XGRAD_HXX
22
23#include <tools/color.hxx>
24#include <tools/degree.hxx>
25#include <svx/svxdllapi.h>
26#include <com/sun/star/awt/GradientStyle.hpp>
27#include <boost/property_tree/ptree_fwd.hpp>
28#include <com/sun/star/awt/Gradient.hpp>
29
30class Gradient;
31
33{
34 css::awt::GradientStyle eStyle;
38 sal_uInt16 nBorder;
39 sal_uInt16 nOfsX;
40 sal_uInt16 nOfsY;
41 sal_uInt16 nIntensStart;
42 sal_uInt16 nIntensEnd;
43 sal_uInt16 nStepCount;
44
45 static std::string GradientStyleToString(css::awt::GradientStyle eStyle);
46
47public:
48 XGradient();
49 XGradient( const Color& rStart, const Color& rEnd,
50 css::awt::GradientStyle eStyle = css::awt::GradientStyle_LINEAR, Degree10 nAngle = 0_deg10,
51 sal_uInt16 nXOfs = 50, sal_uInt16 nYOfs = 50, sal_uInt16 nBorder = 0,
52 sal_uInt16 nStartIntens = 100, sal_uInt16 nEndIntens = 100,
53 sal_uInt16 nSteps = 0 );
54
55 bool operator==(const XGradient& rGradient) const;
56
57 void SetGradientStyle(css::awt::GradientStyle eNewStyle) { eStyle = eNewStyle; }
58 void SetStartColor(const Color& rColor) { aStartColor = rColor; }
59 void SetEndColor(const Color& rColor) { aEndColor = rColor; }
60 void SetAngle(Degree10 nNewAngle) { nAngle = nNewAngle; }
61 void SetBorder(sal_uInt16 nNewBorder) { nBorder = nNewBorder; }
62 void SetXOffset(sal_uInt16 nNewOffset) { nOfsX = nNewOffset; }
63 void SetYOffset(sal_uInt16 nNewOffset) { nOfsY = nNewOffset; }
64 void SetStartIntens(sal_uInt16 nNewIntens) { nIntensStart = nNewIntens; }
65 void SetEndIntens(sal_uInt16 nNewIntens) { nIntensEnd = nNewIntens; }
66 void SetSteps(sal_uInt16 nSteps) { nStepCount = nSteps; }
67
68 css::awt::GradientStyle GetGradientStyle() const { return eStyle; }
69 const Color& GetStartColor() const { return aStartColor; }
70 const Color& GetEndColor() const { return aEndColor; }
71 Degree10 GetAngle() const { return nAngle; }
72 sal_uInt16 GetBorder() const { return nBorder; }
73 sal_uInt16 GetXOffset() const { return nOfsX; }
74 sal_uInt16 GetYOffset() const { return nOfsY; }
75 sal_uInt16 GetStartIntens() const { return nIntensStart; }
76 sal_uInt16 GetEndIntens() const { return nIntensEnd; }
77 sal_uInt16 GetSteps() const { return nStepCount; }
78
79 boost::property_tree::ptree dumpAsJSON() const;
80 static XGradient fromJSON(std::u16string_view rJSON);
81 css::awt::Gradient toGradientUNO() const;
82};
83
84#endif
85
86/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const Color & GetEndColor() const
Definition: xgrad.hxx:70
sal_uInt16 GetYOffset() const
Definition: xgrad.hxx:74
Degree10 nAngle
Definition: xgrad.hxx:37
void SetEndIntens(sal_uInt16 nNewIntens)
Definition: xgrad.hxx:65
sal_uInt16 nIntensStart
Definition: xgrad.hxx:41
sal_uInt16 GetStartIntens() const
Definition: xgrad.hxx:75
css::awt::GradientStyle GetGradientStyle() const
Definition: xgrad.hxx:68
void SetBorder(sal_uInt16 nNewBorder)
Definition: xgrad.hxx:61
sal_uInt16 nOfsX
Definition: xgrad.hxx:39
const Color & GetStartColor() const
Definition: xgrad.hxx:69
sal_uInt16 nBorder
Definition: xgrad.hxx:38
css::awt::GradientStyle eStyle
Definition: xgrad.hxx:34
sal_uInt16 GetBorder() const
Definition: xgrad.hxx:72
sal_uInt16 GetEndIntens() const
Definition: xgrad.hxx:76
sal_uInt16 nIntensEnd
Definition: xgrad.hxx:42
Color aStartColor
Definition: xgrad.hxx:35
Degree10 GetAngle() const
Definition: xgrad.hxx:71
void SetStartColor(const Color &rColor)
Definition: xgrad.hxx:58
sal_uInt16 GetSteps() const
Definition: xgrad.hxx:77
void SetGradientStyle(css::awt::GradientStyle eNewStyle)
Definition: xgrad.hxx:57
void SetXOffset(sal_uInt16 nNewOffset)
Definition: xgrad.hxx:62
sal_uInt16 nOfsY
Definition: xgrad.hxx:40
void SetEndColor(const Color &rColor)
Definition: xgrad.hxx:59
sal_uInt16 nStepCount
Definition: xgrad.hxx:43
void SetAngle(Degree10 nNewAngle)
Definition: xgrad.hxx:60
void SetStartIntens(sal_uInt16 nNewIntens)
Definition: xgrad.hxx:64
sal_uInt16 GetXOffset() const
Definition: xgrad.hxx:73
void SetYOffset(sal_uInt16 nNewOffset)
Definition: xgrad.hxx:63
Color aEndColor
Definition: xgrad.hxx:36
void SetSteps(sal_uInt16 nSteps)
Definition: xgrad.hxx:66
tools::Long const nBorder
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
#define SAL_WARN_UNUSED
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)