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