Warning, file /office/calligra/libs/flake/KoShapeStrokeModel.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 * 0003 * Copyright (C) 2006 Thomas Zander <zander@kde.org> 0004 * Copyright (C) 2007,2009 Thorsten Zachmann <zachmann@kde.org> 0005 * Copyright (C) 2012 Inge Wallin <inge@lysator.liu.se> 0006 * 0007 * This library is free software; you can redistribute it and/or 0008 * modify it under the terms of the GNU Library General Public 0009 * License as published by the Free Software Foundation; either 0010 * version 2 of the License, or (at your option) any later version. 0011 * 0012 * This library is distributed in the hope that it will be useful, 0013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0015 * Library General Public License for more details. 0016 * 0017 * You should have received a copy of the GNU Library General Public License 0018 * along with this library; see the file COPYING.LIB. If not, write to 0019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0020 * Boston, MA 02110-1301, USA. 0021 */ 0022 0023 #ifndef KOSHAPESTROKEMODEL_H 0024 #define KOSHAPESTROKEMODEL_H 0025 0026 #include "flake_export.h" 0027 0028 class KoShape; 0029 class KoGenStyle; 0030 class KoShapeSavingContext; 0031 class KoViewConverter; 0032 struct KoInsets; 0033 0034 class QColor; 0035 class QPainter; 0036 0037 /** 0038 * A model for strokes of KoShapes. 0039 * Classes that implement this model will be allowed to draw the stroke of the outline 0040 * of a shape. 0041 * Note that since the important members take a KoShape as argument it is possible, 0042 * and preferred behavior, to have one instance of a stroke that is reused on several 0043 * objects. 0044 */ 0045 class FLAKE_EXPORT KoShapeStrokeModel 0046 { 0047 public: 0048 KoShapeStrokeModel(); 0049 virtual ~KoShapeStrokeModel(); 0050 0051 /** 0052 * @brief Fill the style object (aka save) 0053 * 0054 * @param style object 0055 * @param context used for saving 0056 */ 0057 virtual void fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const = 0; 0058 0059 /** 0060 * Return a strokeInsets object filled with the size inside the shape that this stroke takes. 0061 * @param shape the shape the insets will be calculated for 0062 * @param insets the insets object that will be filled and returned. 0063 */ 0064 virtual void strokeInsets(const KoShape *shape, KoInsets &insets) const = 0; 0065 /** 0066 * Returns true if there is some transparency, false if the stroke is fully opaque. 0067 * @return if the stroke is transparent. 0068 */ 0069 virtual bool hasTransparency() const = 0; 0070 /** 0071 * Paint the stroke. 0072 * This method should paint the stroke around shape. 0073 * @param shape the shape to paint around 0074 * @param painter the painter to paint to, the painter will have the topleft of the 0075 * shape as its start coordinate. 0076 * @param converter to convert between internal and view coordinates. 0077 */ 0078 virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter) = 0; 0079 0080 /** 0081 * Paint the stroke in the given color 0082 * 0083 * This method should paint the stroke around the shape in the given color. 0084 * 0085 * @param shape the shape to paint around 0086 * @param painter the painter to paint to, the painter will have the topleft of the 0087 * shape as its start coordinate. 0088 * @param converter to convert between internal and view coordinates. 0089 * @param color to use to paint the stroke. 0090 */ 0091 virtual void paint(KoShape *shape, QPainter &painter, const KoViewConverter &converter, const QColor &color) = 0; 0092 0093 /** 0094 * Increments the use-value. 0095 * Returns true if the new value is non-zero, false otherwise. 0096 */ 0097 bool ref(); 0098 /** 0099 * Decrements the use-value. 0100 * Returns true if the new value is non-zero, false otherwise. 0101 */ 0102 bool deref(); 0103 /// Return the usage count 0104 int useCount() const; 0105 0106 private: 0107 class Private; 0108 Private * const d; 0109 }; 0110 0111 #endif