Warning, file /office/calligra/libs/textlayout/KoTextLayoutCellHelper.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) 2006-2010 Thomas Zander <zander@kde.org>
0003  * Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
0004  * Copyright (C) 2008 Roopesh Chander <roop@forwardbias.in>
0005  * Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
0006  * Copyright (C) 2009 KO GmbH <cbo@kogmbh.com>
0007  * Copyright (C) 2011 Pierre Ducroquet <pinaraf@pinaraf.info>
0008  *
0009  * This library is free software; you can redistribute it and/or
0010  * modify it under the terms of the GNU Library General Public
0011  * License as published by the Free Software Foundation; either
0012  * version 2 of the License, or (at your option) any later version.
0013  *
0014  * This library is distributed in the hope that it will be useful,
0015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0017  * Library General Public License for more details.
0018  *
0019  * You should have received a copy of the GNU Library General Public License
0020  * along with this library; see the file COPYING.LIB.  If not, write to
0021  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0022  * Boston, MA 02110-1301, USA.
0023  */
0024 
0025 #ifndef KOTEXTLAYOUTCELLHELPER_H
0026 #define KOTEXTLAYOUTCELLHELPER_H
0027 
0028 #include "kotextlayout_export.h"
0029 
0030 #include <KoBorder.h>
0031 
0032 #include <QObject>
0033 
0034 class KoTableCellStyle;
0035 class QPainter;
0036 
0037 class KOTEXTLAYOUT_EXPORT KoTextLayoutCellHelper : public QObject
0038 {
0039     Q_OBJECT
0040 public:
0041     explicit KoTextLayoutCellHelper(const KoTableCellStyle &cellStyle, QObject *parent = 0);
0042 
0043     /// draws a horizontal wave line
0044     void drawHorizontalWave(KoBorder::BorderStyle style, QPainter &painter, qreal x, qreal w, qreal t) const;
0045 
0046     /// draws a vertical wave line
0047     void drawVerticalWave(KoBorder::BorderStyle style, QPainter &painter, qreal y, qreal h, qreal t) const;
0048 
0049     /**
0050      * Paint the borders.
0051      *
0052      * @param painter the painter to draw with.
0053      * @param bounds the bounding rectangle to draw.
0054      * @param blanks a painterpath where blank borders should be added to.
0055      */
0056     void paintBorders(QPainter &painter, const QRectF &bounds, QVector<QLineF> *blanks) const;
0057 
0058     /**
0059      * Paint the diagonal borders.
0060      *
0061      * @param painter the painter to draw with.
0062      * @param bounds the bounding rectangle to draw.
0063      */
0064     void paintDiagonalBorders(QPainter &painter, const QRectF &bounds) const;
0065 
0066     /**
0067      * Paint the top border.
0068      *
0069      * @param painter the painter to draw with.
0070      * @param x the x position.
0071      * @param y the y position.
0072      * @param w the width.
0073      * @param blanks a painterpath where blank borders should be added to.
0074      */
0075     void drawTopHorizontalBorder(QPainter &painter, qreal x, qreal y, qreal w, QVector<QLineF> *blanks = 0) const;
0076 
0077     /**
0078      * Paint the border that is shared.
0079      * It only draws the thickest and it always draws it below the y position.
0080      *
0081      * @param painter the painter to draw with.
0082      * @param styleBelow the table cell style.
0083      * @param x the x position.
0084      * @param y the y position.
0085      * @param w the width.
0086      * @param blanks a painterpath where blank borders should be added to.
0087      */
0088     void drawSharedHorizontalBorder(QPainter &painter, const KoTableCellStyle &styleBelow,  qreal x, qreal y, qreal w, QVector<QLineF> *blanks = 0) const;
0089 
0090     /**
0091      * Paint the bottom border.
0092      *
0093      * @param painter the painter to draw with.
0094      * @param x the x position.
0095      * @param y the y position.
0096      * @param w the width.
0097      * @param blanks a painterpath where blank borders should be added to.
0098      */
0099     void drawBottomHorizontalBorder(QPainter &painter, qreal x, qreal y, qreal w, QVector<QLineF> *blanks = 0) const;
0100 
0101     /**
0102      * Paint the leftmost border.
0103      *
0104      * @param painter the painter to draw with.
0105      * @param x the x position.
0106      * @param y the y position.
0107      * @param h the height.
0108      * @param blanks a painterpath where blank borders should be added to.
0109      */
0110     void drawLeftmostVerticalBorder(QPainter &painter, qreal x, qreal y, qreal h, QVector<QLineF> *blanks = 0) const;
0111 
0112     /**
0113      * Paint the border that is shared.
0114      * It only draws the thickest and it always draws it to the right of the x position.
0115      *
0116      * @param painter the painter to draw with.
0117      * @param styleRight the table cell style.
0118      * @param x the x position.
0119      * @param y the y position.
0120      * @param h the height.
0121      * @param blanks a painterpath where blank borders should be added to.
0122      */
0123     void drawSharedVerticalBorder(QPainter &painter, const KoTableCellStyle &styleRight,  qreal x, qreal y, qreal h, QVector<QLineF> *blanks = 0) const;
0124 
0125     /**
0126      * Paint the rightmost border.
0127      *
0128      * @param painter the painter to draw with.
0129      * @param x the x position.
0130      * @param y the y position.
0131      * @param h the height.
0132      * @param blanks a painterpath where blank borders should be added to.
0133      */
0134     void drawRightmostVerticalBorder(QPainter &painter, qreal x, qreal y, qreal h, QVector<QLineF> *blanks = 0) const;
0135 
0136 private:
0137     const KoTableCellStyle &m_cellStyle;
0138 };
0139 
0140 #endif // KOTEXTLAYOUTCELLHELPER_H