Warning, file /office/calligra/libs/flake/KoFilterEffectStack.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) 2009 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 Lesser General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2.1 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 Lesser 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 KOFILTEREFFECTSTACK
0021 #define KOFILTEREFFECTSTACK
0022 
0023 #include "flake_export.h"
0024 
0025 #include <QList>
0026 
0027 class KoFilterEffect;
0028 class KoXmlWriter;
0029 
0030 class QRectF;
0031 
0032 /// This class manages a stack of filter effects
0033 class FLAKE_EXPORT KoFilterEffectStack
0034 {
0035 public:
0036     /// Creates an empty filter effect stack
0037     KoFilterEffectStack();
0038 
0039     /// Destroys the filter effect stack, deleting all filter effects
0040     ~KoFilterEffectStack();
0041 
0042     /**
0043     * The first filter of the list is the first to be applied.
0044     *
0045     * @return the list of filter effects applied on the shape when rendering.
0046     */
0047     QList<KoFilterEffect*> filterEffects() const;
0048 
0049     /**
0050     * Returns if the filter effect stack is empty.
0051     * @return false if the stack contains filter effects, otherwise true
0052     */
0053     bool isEmpty() const;
0054 
0055     /**
0056     * Inserts a new filter at the given position in the filter list.
0057     *
0058     * The filter stack take ownership of the inserted filter effect.
0059     *
0060     * @param index the list index to insert the new filter at
0061     * @param filter the new filter to insert
0062     */
0063     void insertFilterEffect(int index, KoFilterEffect *filter);
0064 
0065     /**
0066     * Appends a new filter at the end of the filter list.
0067     *
0068     * The filter stack take ownership of the appended filter effect.
0069     *
0070     * @param filter the new filter to append
0071     */
0072     void appendFilterEffect(KoFilterEffect *filter);
0073 
0074     /**
0075     * Removes the filter with the given index from the filter list.
0076     *
0077     * The filter gets deleted after removal from the list.
0078     *
0079     * @param index the index of the filter to remove
0080     */
0081     void removeFilterEffect(int index);
0082 
0083     /**
0084      * Take filter effect with given index from the stack and returns it.
0085      * @param index the index of the filter to take
0086      * @return the filter effect, of 0 if no filter effect with the given index exists
0087      */
0088     KoFilterEffect* takeFilterEffect(int index);
0089 
0090     /// Sets the clipping rectangle used for this filter in bounding box units
0091     void setClipRect(const QRectF &clipRect);
0092 
0093     /// Returns the clipping rectangle used for this filter in bounding box units
0094     QRectF clipRect() const;
0095 
0096     /// Returns the clipping rectangle for the given bounding rect
0097     QRectF clipRectForBoundingRect(const QRectF &boundingRect) const;
0098 
0099     /**
0100      * Increments the use-value.
0101      * Returns true if the new value is non-zero, false otherwise.
0102      */
0103     bool ref();
0104 
0105     /**
0106      * Decrements the use-value.
0107      * Returns true if the new value is non-zero, false otherwise.
0108      */
0109     bool deref();
0110 
0111     /// Return reference counter
0112     int useCount() const;
0113 
0114     /**
0115     * Saves filter stack using given xml writer.
0116     * @param writer the xml writer to write data to
0117     * @param id the filter id to write, used for referencing the filter
0118     */
0119     void save(KoXmlWriter &writer, const QString &filterId);
0120 
0121     /// Returns list of required standard inputs
0122     QSet<QString> requiredStandarsInputs() const;
0123 private:
0124     class Private;
0125     Private * const d;
0126 };
0127 
0128 #endif // KOFILTEREFFECTSTACK