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