1 /* This file is part of the KDE project 2 Copyright (C) 2004-2006 David Faure <faure@kde.org> 3 Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net> 4 Copyright (C) 2007 Thorsten Zachmann <zachmann@kde.org> 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Library General Public 8 License as published by the Free Software Foundation; either 9 version 2 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Library General Public License for more details. 15 16 You should have received a copy of the GNU Library General Public License 17 along with this library; see the file COPYING.LIB. If not, write to 18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA. 20 */ 21 22 #ifndef KOODFGRAPHICSTYLES_H 23 #define KOODFGRAPHICSTYLES_H 24 25 #include "koodf_export.h" 26 27 #include <QTransform> 28 29 class QBrush; 30 class QPen; 31 class QString; 32 class QSizeF; 33 34 class KoGenStyle; 35 class KoGenStyles; 36 class KoStyleStack; 37 38 class KoOdfStylesReader; 39 40 namespace KoOdfGraphicStyles 41 { 42 KOODF_EXPORT void saveOdfFillStyle(KoGenStyle &styleFill, KoGenStyles& mainStyles, const QBrush &brush); 43 44 KOODF_EXPORT void saveOdfStrokeStyle(KoGenStyle &styleStroke, KoGenStyles &mainStyles, const QPen &pen); 45 46 KOODF_EXPORT QString saveOdfHatchStyle(KoGenStyles &mainStyles, const QBrush &brush); 47 48 /// Saves gradient style of brush into mainStyles and returns the styles name 49 KOODF_EXPORT QString saveOdfGradientStyle(KoGenStyles &mainStyles, const QBrush &brush); 50 51 /// Loads gradient style from style stack and stylesReader adapted to the given size and returns a brush 52 KOODF_EXPORT QBrush loadOdfGradientStyle(const KoStyleStack &styleStack, const KoOdfStylesReader &stylesReader, const QSizeF &size); 53 54 /// Loads gradient style with the given name from style stack and stylesReader adapted to the given size and returns a brush 55 KOODF_EXPORT QBrush loadOdfGradientStyleByName(const KoOdfStylesReader &stylesReader, const QString &styleName, const QSizeF &size); 56 57 KOODF_EXPORT QBrush loadOdfFillStyle(const KoStyleStack &styleStack, const QString &fill, const KoOdfStylesReader &stylesReader); 58 59 KOODF_EXPORT QPen loadOdfStrokeStyle(const KoStyleStack &styleStack, const QString &stroke, const KoOdfStylesReader &stylesReader); 60 61 /// Helper function to parse a transformation attribute 62 KOODF_EXPORT QTransform loadTransformation(const QString &transformation); 63 64 /// Helper function to create a transformation attribute 65 KOODF_EXPORT QString saveTransformation(const QTransform &transformation, bool appendTranslateUnit = true); 66 } 67 68 #endif /* KOODFGRAPHICSTYLES_H */ 69