Warning, file /office/calligra/libs/flake/KoGradientBackground.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KOGRADIENTBACKGROUND_H
0021 #define KOGRADIENTBACKGROUND_H
0022 
0023 #include "KoShapeBackground.h"
0024 #include "flake_export.h"
0025 
0026 #include <QTransform>
0027 
0028 class QGradient;
0029 class KoGradientBackgroundPrivate;
0030 
0031 /// A gradient shape background
0032 class FLAKE_EXPORT KoGradientBackground : public KoShapeBackground
0033 {
0034 public:
0035     /**
0036      * Creates new gradient background from given gradient.
0037      * The background takes ownership of the given gradient.
0038      */
0039     explicit KoGradientBackground(QGradient *gradient, const QTransform &matrix = QTransform());
0040 
0041     /**
0042      * Create new gradient background from the given gradient.
0043      * A clone of the given gradient is used.
0044      */
0045     explicit KoGradientBackground(const QGradient &gradient, const QTransform &matrix = QTransform());
0046 
0047     /// Destroys the background
0048     ~KoGradientBackground() override;
0049 
0050     /// Sets the transform matrix
0051     void setTransform(const QTransform &matrix);
0052 
0053     /// Returns the transform matrix
0054     QTransform transform() const;
0055 
0056     /**
0057      * Sets a new gradient.
0058      * A clone of the given gradient is used.
0059      */
0060     void setGradient(const QGradient &gradient);
0061 
0062     /// Returns the gradient
0063     const QGradient *gradient() const;
0064 
0065     /// reimplemented from KoShapeBackground
0066     void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &context, const QPainterPath &fillPath) const override;
0067     /// reimplemented from KoShapeBackground
0068     void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) override;
0069     /// reimplemented from KoShapeBackground
0070     bool loadStyle(KoOdfLoadingContext &context, const QSizeF &shapeSize) override;
0071 
0072 private:
0073     Q_DECLARE_PRIVATE(KoGradientBackground)
0074     Q_DISABLE_COPY(KoGradientBackground)
0075 };
0076 
0077 #endif // KOGRADIENTBACKGROUND_H